Tinz
Tinz

Reputation: 123

Azure DevOps REST API call retrieving only 100 records

I am using the below url for retrieving all the CouldTests, but it is returning only top 100 records. Is it possible to retrieve all the records?.

http://{instance}/{collection}/{project}/_apis/test/runs?api-version=5.0

Any help is appreciated. Thanks in advance

For more about the above Link please refer.:https://learn.microsoft.com/en-us/rest/api/azure/devops/test/runs/list?view=azure-devops-server-rest-5.0

Upvotes: 2

Views: 6846

Answers (3)

KOmrAD
KOmrAD

Reputation: 93

Accepted answer was not working for me. Probably they have changed the parameter name from $top, to searchCriteria.$top.

If that is not working, try this instead: https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits?searchCriteria.$top=1000&api-version=6.0

Documentation: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/commits/get-commits?view=azure-devops-rest-6.0

Upvotes: 0

Yang Shen - MSFT
Yang Shen - MSFT

Reputation: 1214

it is returning only top 100 records.

This is because

On large collections, performance degrades when retrieving the later pages.

To avoid stress on the server, 100 is the default page size of REST api response which you can refer to REST API Result limit.

Is it possible to retrieve all the records?

Yes, as @Shayki Abramczyk said, the solution is to add a top parameter to select the top n records, make sure the n is bigger than the total amount of your all records.

For this solution, you can also check Limited to 100 result TFS api and Azure DevOps REST API: project count returned limited to 100.

Upvotes: 2

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41565

You can use the $top parameter in the URL:

http://{instance:/{collection}/{projects}/_apis/test/runs?api-versopn=5.0&$top=500

Upvotes: 2

Related Questions