get bamboo project key using curl

Here is what I am trying to do:

If I query Bamboo Project name to Bamboo REST API using Curl , Expected output is: Project Key.

If I query Bamboo Plan Name to Bamboo REST API using Curl , Expected output is: plan key.

3 answers

1 accepted

0 votes
Answer accepted

For this particular scenario I'd query Bamboo REST to list all plans:


and then use the information from response (plan key + plan name) to populate your UI controls. Then you'll display plan name and store plan key.

Yes, thats what I did. But the problem with this method is... if a project is having more than 40 plans, I have write a script to basically iterate all plans to get a key for a plan.

Since this is simple query, thought there would a direct solution for it.

But, thanks for your Inputs.

0 votes


The whole REST API is build the other way around. You're exepected to know the project/plan key and then you can get more detailed information. Example for plan BAM-FC:

curl --header "Accept: application/json" $BAMBOO_URL/rest/api/latest/plan/BAM-FC

will give you

    "expand": "actions,stages,branches,variableContext",
    "projectKey": "BAM",
    "projectName": "+core+ Bamboo",
    "project": {
        "key": "BAM",
        "name": "+core+ Bamboo",
        "link": {
            "href": "$BAMBOO_URL/rest/api/latest/project/BAM",
            "rel": "self"
    "description": "Our main CI test build.",
    "shortName": "A CI Tests Master",
    "buildName": "A CI Tests Master",
    "shortKey": "FC",
    "type": "chain",
    "enabled": true,
    "link": {
        "href": "$BAMBOO_URL/rest/api/latest/plan/BAM-FC",
        "rel": "self"
    "isFavourite": false,
    "isActive": false,
    "isBuilding": false,
    "averageBuildTimeInSeconds": 3627,
    "actions": {
        "size": 1,
        "start-index": 0,
        "max-result": 1
    "stages": {
        "size": 2,
        "start-index": 0,
        "max-result": 2
    "branches": {
        "size": 25,
        "start-index": 0,
        "max-result": 25
    "variableContext": {
        "size": 30,
        "max-results": 30
    "key": "BAM-FC",
    "name": "+core+ Bamboo - A CI Tests Master",
    "planKey": {
        "key": "BAM-FC"

Can you please explain why would you like to query REST API with plan name?

One good reason -- Bamboo does not display the Project/Plan keys any where except in the build log files.

Its hard to explain, but try to put this way, my JIRA ticket is accepting two fileds that are related to Bamboo (1. Project Name 2. Plan Name). I am writing a script to auto execute the Bamboo Plan, based on the JIRA Ticket. For this I had to build a Bamboo Plan url (based on the Project Name or Plan Name that I am capturing from JIRA Ticket) which requires Bamboo Plan Key.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published 9 hours ago in Opsgenie

Getting the Most out of Atlassian and Opsgenie Together

We’re excited to invite you to this action-packed webinar where we will demonstrate how to integrate Opsgenie’s powerful alerting and on-call management tools with your entire Atlassian stack. Mar...

16 views 0 0
Read article

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