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

How to get a list of plans by project?

Jesse Josserand March 26, 2015

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://wiki.example.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://wiki.example.com/jira/rest/api/1.0/search/plans?searchTerm=$PROJECTNAME ";

# above returns 404

system $cmd;

1 answer

0 votes
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 26, 2015

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://wiki.example.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://wiki.example.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

JosserandAceConsultinG March 27, 2015

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.

JosserandAceConsultinG March 27, 2015

my $cmd = "curl -H \"Content-Type: application/json\" -u $username:$pass http://wiki.example.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
TAGS
AUG Leaders

Atlassian Community Events