How to get a list of plans by project?

I have a web app deployment dashboard done in php/mysql that is currently using a table containing App names that relate to Projects and Plans in Bamboo, but is not integrated there. Thus, am getting bad data entered by folks manually when updating that dashboard with deployment information. I would like to either eliminate the need for the App list table by populating that page in my dashboard directly from Bamboo or keeping that table up-to-date with a similar call to Bamboo. I have successfully gotten 'some' data using the following, but it is not what I'm looking for exactly and is incomplete. Can anyone provide a more accurate REST API call that will provide me a list of Plans by Project from Bamboo?

Here's what I've tried with 'some' success so far...

...perl script...

# /rest/api/latest/project?expand=projects.project.plans
# my $cmd = "curl -H \"Content-Type: application/json\" -u $username:$pass http://wagwiki.walgreens.com/jira/rest/api/latest/project?expand=projects.project.plans";
# /rest/api/latest/project/KEY?expand=plans
# my $KEY="ERX";
# my $cmd = "curl -H \"Content-Type: application/json\" -u $username:$pass http://wagwiki.walgreens.com/jira/rest/api/latest/project/$KEY?expand=plans";

# above returns data but not exactly what I need.


# rest/api/1.0/search/plans?searchTerm=PROJECTNAME
# my $PROJECTNAME="eRx_Automation";
my $PROJECTNAME="ERXAUTOMATION";
# my $cmd = "curl -H \"Content-Type: application/json\" -u $username:$pass http://wagwiki.walgreens.com/jira/rest/api/1.0/search/plans?searchTerm=$PROJECTNAME";

# above returns 404

system $cmd;

1 answer

0 votes

Hello Jesse,

Thank you for your question.

Could you please make sure you are running the REST API call against Bamboo, as it seems you are running it against JIRA based on the URL (http://wagwiki.walgreens.com/jira) mentioned.

Please, notice you can loop through the projects and plans by using its iterator as per following:

# BAMBOO-BASE-URL, i.e.: http://wagwiki.walgreens.com/bamboo
# A, <projects expand="project" start-index="0" max-result="3" size="3"> where you can go from 0 to 2
# B, <plans expand="plan" start-index="0" max-result="17" size="17"> where you can go from 0 to 16
http://[BAMBOO-BASE-URL]/rest/api/latest/project?expand=projects[A].project.plans[B]

Please, refer to Bamboo REST API for further information.

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

Thanks! I'll give that a try - I did realize before your answer that I should have been specifying bamboo not jira and that returned 'some' data - for instance, I've been able to get 500 of 629 plans, but can't seen to access those that would appear after clicking the show more plans button in bamboo. Hopefully, your suggestion will solve that problem for me. Thanks again.

my $cmd = "curl -H \"Content-Type: application/json\" -u $username:$pass http://wagwiki.walgreens.com/bamboo/rest/api/latest/project?expand=projects[1].project.plans[1]"; system $cmd; curl: (3) [globbing] error: bad range specification after pos 77 what am I doing wrong - it gives that error no matter what values I put in brackets

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Dec 06, 2018 in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

5,560 views 22 17
View question

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you