Accessing Certify Results API from Microsoft PowerShell

You can access Certify Results API from Microsoft® PowerShell®.

To access Certify Results API from Microsoft PowerShell:

  1. Open the Certify Results API Swagger page:

    http(s)://yourdomain/CertifyResultsAPI/swagger/ui/index

  2. Generate a token. For more information, see Generating a Token in Certify Results API.

  3. Add the API token to Swagger.

  4. Enter the required inputs to the endpoint you intend to use in PowerShell.

  5. Click the Try it out! button.
  6. Verify the response code is 200.
  7. 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

  8. Save the script with a PowerShell extension (.ps1).
  9. From Swagger, copy the following information:
  10. resultsAPIToken
  11. resultsAPIResultsFolderUrl

  1. In the script, replace the resultsAPIToken and resultsAPIResultsFolderURL values.

  2. Save the script.

    You can now access Certify Results API in PowerShell.

 

Related Topics Link IconRelated Topics