问题
I am using the below API call for retrieving all the CouldTests, but it is returning only 100 records. How can retrieve all the records?.
$uri = https://{instance}/{collection}/{project}/_apis/test/runs?minLastUpdatedDate=2020-01-28&maxLastUpdatedDate=2020-01-29&releaseIds=123456&$top=2000
$TestRuns = Invoke-RestMethod
-Uri $uri
-Headers $headers
Any help is appreciated. Thanks in advance
For more about the above Link please refer.:https://docs.microsoft.com/en-us/rest/api/azure/devops/test/runs/query?view=azure-devops-server-rest-5.0
回答1:
See the continuationToken portion of that doc link that you reference. Basically, if the response contains a continuationToken, then you have to call the API again and pass in that continuationToken, repeating until there is no more continuationToken in the response.
This is common across most Azure APIs, although sometimes the naming is different such as nextLink.
回答2:
Used Invoke-WebRequest instead of Invoke-RestMethod and it is working.
来源:https://stackoverflow.com/questions/59952258/azure-devops-rest-api-call-retrieving-only-top-100-records