Azure DevOps REST API call retrieving only top 100 records

北城以北 提交于 2020-03-05 04:04:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!