Forum Discussion
surendra-p
Dec 02, 2024Copper Contributor
azure board what is the max page size limit for get projects api
if the number of project exceeds this limit how can we retrieve the next set of project using pagination?
please explain the use of parameter and any example if possible.
- surendra-pCopper Contributor
kyawkyawk when we see the continuationToken in response , i have around the 15 project but no such token in my response body .
also i want to know Is there a way to filter the projects by project name search functionality - kyazaferrSteel Contributor
In Azure Boards, the Get Projects API in Azure DevOps has a maximum page size limit of 100 projects per request. If the total number of projects exceeds this limit, you can retrieve the next set of projects using pagination by leveraging the continuationToken parameter.
- surendra-pCopper Contributor
kyazaferr i am using GET https://dev.azure.com/{org}/_apis/projects?api-version=7.1
seens this api returns the 213 projects per request , is the limit based on api version specific.
i have total 213 projects and all are returned in single requests
- kyazaferrSteel Contributor
The limit for the number of projects returned by the Azure DevOps REST API's GET https://dev.azure.com/{org}/_apis/projects?api-version=7.1 request is not version-specific. Instead, it depends on the default behavior of the API, which typically uses a top query parameter to limit the number of items returned in a response.
Key Points:
- Default Behavior:
- If you do not specify the top parameter in your request, the API will return all projects up to its internal maximum limit.
- In your case, since you have 213 projects and they are all returned in one request, it means your total number of projects fits within the default limit.
- Pagination:
- If the number of projects exceeded the internal limit (e.g., 1000 for some APIs), the response would include a continuationToken. This token is used to fetch the next set of results in subsequent requests.
- You can also control the number of projects returned in each request by explicitly using the top query parameter (e.g., https://dev.azure.com/{org}/_apis/projects?api-version=7.1&$top=100).
- Behavior Across API Versions:
- The API version does not significantly alter the behavior for retrieving projects. The 7.1 version is the latest and includes support for the same parameters and pagination as earlier versions.
Recommendations:
- If you expect your number of projects to grow, you might want to test with pagination to ensure your application handles it gracefully.
- Use the continuationToken from the response header to retrieve additional pages of results if necessary.
- Default Behavior: