REST API to get queued builds for related agents

Michael November 21, 2022

Hi,

I need to automatically get all queued build jobs that can be build by a specific agent. What I want is the list you can get in each agents overview page in the "Executable jobs" and "Executable deployment environments" tabs.

But actually it's hard to get this information using the REST API. The Endpoint /agent/assignment provides "nameElements" - a list of project, plan and job names. But The /queue endpoint provides keys of the projects, plans and jobs ("PROJ-PLAN-JOB").

With detours via /plan and /project endpoints I can determine name-key matching. But to find the key for jobs I need to call /search/jobs/{planKey} for each agent assignment on a job.

Isn't there an easier and more resource saving way to get all queued builds for a specific agent?

1 answer

1 vote
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 21, 2022

Hello @Michael

You will have to use SQL to retrieve what you want. Please check the following KB article for some sample queries. You may have to adapt them to your requirements.

Sincerely,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Michael November 22, 2022

Thanks for that hint. Unfortunately I don't have database access.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events