Search code examples
azure-devops-extensions

Azure DevOps Extension Development - Using GetBuilds API - How to use continuationToken?


I'm developing an Azure DevOps extension which lists all builds for a project. I'm using GetBuilds API from BuildRestClient class.

I have 1500 builds in my project, when I make above API call it only returns 1000 builds. In order to fetch remaining 500 builds, I know I have to make another API call by passing "continuationToken" parameter to API.

But the question is how to fetch the continuationToken from the first API call? I tried to look for the solution everywhere, couldn't find any!!

PS: I've tried fetching builds using ListBuilds REST APIs through Postman, able to fetch all 1500 by making two API calls. First API call returns 1000 builds along with continuationToken as part of response header, which is used to fetch remaining builds by passing header value as input parameter to second API call.


Solution

  • As of now, we cannot get the continuationToken as part of GetBuilds API result. We need to call build List api and parse response header to get continuation token.

    Got this workaround from developer community. Check here.