Accessing Certify Results API from Microsoft PowerShell
You can access Certify Results API from Microsoft® PowerShell®.
To access Certify Results API from Microsoft PowerShell:
-
Open the Certify Results API Swagger page:
http(s)://yourdomain/CertifyResultsAPI/swagger/ui/index
-
Generate a token. For more information, see Generating a Token in Certify Results API.
-
Add the API token to Swagger.
-
Enter the required inputs to the endpoint you intend to use in PowerShell.
- Click the Try it out! button.
- Verify the response code is 200.
-
Open a text editor and paste the following PowerShell script into a blank document:
#Prepare for request
$resultsAPIToken = '39a0dddd-d2b2-4d74-bf69-81182ddefd12'
$resultsAPIResultsFoldersUrl = 'http://yourdomain/CertifyResultsAPI/api/v1/projects/Test%20Project/ResultFolders/%2FTest%20Project?endDate=-40'
# Send Request
$Response = Invoke-WebRequest -URI $resultsAPIResultsFoldersUrl -Method Get -Headers @{"token"="$resultsAPIToken"}
# Process Request
## Print all response
Write-Output $Response
## Convert the Response content to JSON
$JsonData = $Response.Content | ConvertFrom-Json
## Fetch a property from the first returned result
Write-Output $JsonData.Results[0].Status
- Save the script with a PowerShell extension (.ps1).
- From Swagger, copy the following information:
- resultsAPIToken
- resultsAPIResultsFolderUrl
-
In the script, replace the resultsAPIToken and resultsAPIResultsFolderURL values.
-
Save the script.
You can now access Certify Results API in PowerShell.