Search code examples
tfsazure-devopsvisual-studio-extensions

VSTS/TFS Extension Development - URL Limit for GET Request for getWorkItems() Method


We are developing a VSTS/TFS Extension. We are also querying Work Items data using Rest Client provided by VSTS/TFS. We are using below method to Get Details of all the work items - https://learn.microsoft.com/en-us/azure/devops/extend/reference/client/api/tfs/workitemtracking/restclient/workitemtrackinghttpclient2_1?view=vsts#method_getWorkItems

The method getWorkItems generates a GET request. All the Work Item IDs are passed as query parameters which exceed the URL Limit of 2048 characters. Thus to tackle that, for now, we are splicing the work items Ids in smaller chunks. But then it increases the Rest API calls.

Is there any other method through which I can Get details of all work Items using any method in VSTS/TFS defined list?


Solution

  • Here's the answer

    let client = VssService.getCollectionClient(WitClient.WorkItemTrackingHttpClient5);
    client.getWorkItemsBatch(<WitContracts.WorkItemBatchGetRequest>{ ids: [1, 2, 3] })