Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,294,815
Community Members
 
Community Events
165
Community Groups

Getting child plans of each parent plan in Bamboo via REST api?

Edited

Version of Bamboo is 6.4.0 rc1.

 When we are using REST API request to get child plans of the parent plan, we are recieving the entire list of existing plans.

Example of request:
http: // localhost: 8085 / bamboo / rest / api / latest / dependency / search / ESBDLV9-TEST / child? searchTerm =
But in our case we would like to get only child plans. What would be the correct REST API call in our case?

For information here is the plan with dependencies from the Java specs view.

@BambooSpec
public class PlanSpec {
    
    public Plan plan () {
        Final Plan Plan = new Plan (new Project ()
                .oid (new BambooOid ("1113k510uyv42")))
                .key (new BambooKey ("ESBDLV9"))
                .name ("ESB deliveries 9.0")
                .description ("ESB deliveries 9.0"),
            "Test",
            new BambooKey ("TEST"))
 .......
            .triggers (new RepositoryPollingTrigger ())
            .planBranchManagement (new PlanBranchManagement ()
                    .delete (new BranchCleanup ())
                    .notificationForCommitters ())
            .dependencies (new Dependencies ()
                    .childPlans (new PlanIdentifier ("ESB9", "IBPORTAL9"),
                        new PlanIdentifier ("ESB9", "BSCASHDESK")))
            .forceStopHungBuilds ();
        return plan;
    }
    
    public PlanPermissions planPermission () {
        final PlanPermissions planPermission = new PlanPermissions (new PlanIdentifier ("ESBDLV9", "TEST"))
            .permissions (new Permissions ()

........
        return planPermission;
    }
    
    public static void main (String ... argv) {
        // By default credentials are read from the '.credentials' file.
        BambooServer bambooServer = new BambooServer ("http: // localhost: 8080 / bamboo");
        final PlanSpec planSpec = new PlanSpec ();
        
        final Plan plan = planSpec.plan ();
        bambooServer.publish (plan);
        
        final PlanPermissions planPermission = planSpec.planPermission ();
        bambooServer.publish (planPermission);
    }
}

1 answer

1 vote
robhit Atlassian Team Apr 05, 2018

Hi Timoschenko,

Thanks for your question!

The reason you are getting the entire list of the plans is that the API response is expected to give all plans that would be available to use as a child dependency.

So if we don't specify a search term, then all plans that are available to use as a child dependency will be returned.

For your specific requirement, there is already an open feature request which you can access here - https://jira.atlassian.com/browse/BAM-18429

Thanks,

Robhit

Hi Robhit,

I have child build that is called "ESBDLV9-ATEST". 

How can I compose the API call in order to get the last parent build name as the screenshot below.

How to use searchTerm correctly.

parentbuild.png

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center on Kubernetes

Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...

933 views 3 8
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you