Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Using REST Api to query plan, stage, job and task detail

Ron Turner
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 30, 2024

I have created a Bamboo project ( version 9.2.11) with a plan that includes stages jobs and tasks. I have not yet built the project only configured the plan stages jobs and tasks.

I am able to use the REST API to query project and plan information with no problem.

For example, "https://bamboo....../bamboo/rest/api/latest/project/<PROJECT-KEY>" returns my project name.

For example, "https://bamboo....../bamboo/rest/api/latest/project/<PROJECT-KEY>?expand=plans" returns a list of my plans

For example, "https://bamboo....../bamboo/rest/api/latest/plan/<PLAN-KEY>?expand=stages"  returns stages for a given plan.

These all work fine. The issue comes in when I attempt  to query deeper into a stage to get job and task information. What would the syntax be list out all the jobs in a stage? What about all the tasks in a job? What about the config information for a task?

Thanks

 

1 answer

1 vote
Shashank Kumar
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 30, 2024

Hello Ron,

Welcome to Atlassian Community.

For Jobs you can use the below REST API, details are available here 

 curl --request GET \
--user user_id:password \
--url 'http://bamboo921:8085/rest/api/latest/search/jobs/PLAN-KEY' \
--header 'Accept: application/json'

 For Tasks currently there is no REST API, however there is a feature request created you can refer for more details BAM-20540 API to produce a list of build plans and their corresponding tasks 

There are couple of workarounds you can follow for example

1. Export the plan as specs via REST API to view all the plans, Jobs and the Tasks

2. Run a DB query to extract the result from the Database.

Do let me know if anyone of the workarounds interests you, I'll try to help you with that.

Regards,

Shashank Kumar

**please don't forget to Accept the answer if your query was answered**

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events