Forum Discussion
surendra-p
Dec 02, 2024Copper Contributor
what is the page size limit for Retrieve Work items associated with iteration path
I am using wqql api for retrieving the iteration associated work items , what is the max limit for page response and what if the page response size exceed
balasubramanim
Dec 03, 2024Iron Contributor
The Azure DevOps WIQL API typically limits responses to 200 work items per page. If the response exceeds this, it uses pagination with a continuationToken to fetch the next page.
Handling Pagination -
Process the first set of work items.
Use the continuationToken to fetch subsequent pages.
Reference URL: https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/wiql?view=azure-devops-rest-7.1
surendra-p
Dec 03, 2024Copper Contributor
balasubramanim when and where the continuationToken is visible and how to read the continuationToken from the response
- balasubramanimDec 03, 2024Iron Contributor
The continuationToken is provided in the response headers when using the Azure DevOps WIQL API, specifically when the query result exceeds the 200 work items per page limit. It is not part of the response body but is included as a header.
POST https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/wiql?api-version=7.1- surendra-pDec 04, 2024Copper Contributor
I am using API for retrieving the project level iteration Work items
POST https://dev.azure.com/{organization}/Test demo Project1/_apis/wit/wiql?api-version=7.1
{
"query": "Select [System.id] From WorkItems Where [System.IterationPath] under 'Test demo Project1\\release1' AND [System.WorkItemType] IN ('task','epic','user story')"
}
response :
{
"queryType": "flat",
"queryResultType": "workItem",
"asOf": "2024-12-04T08:55:56Z",
"columns": [
{
"referenceName": "System.Id",
"name": "ID",
"url": "https://dev.azure.com/surendrap0512/_apis/wit/fields/System.Id"
}
],
"workItems": [
{
"id": 82,
"url": "https://dev.azure.com/surendrap0512/5578bdfc-1b4a-44f6-bfc8-7eb4b8f470dd/_apis/wit/workItems/82"
},
around 257 Work items in the List
]
}
API is fetching more than 250 list of work items , i am not sure about what is the exact limit of this api and why continuationToken is not visible
- balasubramanimDec 04, 2024Iron Contributor
The Azure DevOps WIQL API's behavior depends on the specifics of the query and the number of work items being fetched. Based on your scenario, here are key points
Why the Continuation Token Might Not Be Visible
No Pagination Triggered - The continuation token (x-ms-continuationtoken) is only included in the response headers when the result exceeds the API’s default page size limit, which is typically 200 work items per page.
If your query fetched 257 items in a single response, it means that the API didn’t hit its pagination limit. This could happen if Azure DevOps dynamically adjusts the page size to accommodate the query or environment-specific optimizations are in place.Flat Query Results - In your query, you’re fetching only the System.Id field, which results in a relatively lightweight response. If the server can handle this small payload in one go, it may choose not to paginate.
Azure DevOps Configuration - Some environments or organizations may have custom settings that allow for larger payloads to be returned without triggering pagination. These configurations could vary between on-premises and cloud-hosted Azure DevOps instances.
By design, the WIQL API limits the number of work items per response to 200 items in most cases.
- Since you are fetching only System.Id (and not detailed fields), the response size is small enough for the server to handle the entire dataset in a single page.
- Azure DevOps might optimize responses based on server capabilities or the organization’s configuration.Run Queries with Larger Data Sets - Test a query that returns thousands of work items. This will help determine if and when the API uses pagination.
Force Smaller Pages - Use the $top parameter to explicitly limit the number of items per response.
Example - {
"query": "Select [System.Id] From WorkItems Where [System.IterationPath] under 'Test demo Project1\\release1' AND [System.WorkItemType] IN ('task','epic','user story')",
"$top": 100
}If a query should paginate, the continuation token will appear in the response headers with the key x-ms-continuationtoken.