MarcD
MarcD

Reputation: 137

What does the query string completedRequestCount for the jobrequest endpoint return?

I am calling the jobrequest endpoint of the pools resource. Adding the querystring completedRequestCount returns a pattern I cannot figure out. (This api is undocumented).

https://dev.azure.com/{orgname}/_apis/distributedtask/pools/{poolId}/jobrequests/?completedRequestCount={int}

The returned jobs don't seem to be in a strict chronological order. The returned jobs are normally jobs that have been run recently.

What is the query string completedRequestCount returning and how does the changing of {int} affect it?

Upvotes: 1

Views: 370

Answers (2)

MarcD
MarcD

Reputation: 137

Following from Hugh Lin's answer, I discovered that https://dev.azure.com/{org}/_apis/distributedtask/pools/{poolId}/jobrequests?completedRequestCount=1 returns the last completed job for each agent in the pool and are grouped by agent in chronological order.

The pool where I received 9 results when ?completedRequestCount=1contained 9 agents, the pool where I received 2 results only had 2 agents.

When completedRequestCount=2 then the last two completed jobs are returned for each agent.

Upvotes: 2

Hugh Lin
Hugh Lin

Reputation: 19361

I tried to add agentId parameter in the request url ,the returned count shows normal, completedRequestCount parameter is used to specify the count of latest job requests returned. You can refer to this case.

https://dev.azure.com/{org}/_apis/distributedtask/pools/{poolId}/jobrequests?agentId={agentId}&completedRequestCount={int}

Below is my test in postman :

enter image description here

Upvotes: 3

Related Questions