Hi Team,
I have {projectKey} and {buildKey}, is it possible to get {jobKey} of this BP using Bamboo REST API?
I found how to get the value as {projectKey}-{buildKey}-{jobKey} . But I need only jobKey.
Hello @Valerii
This jq filter will do the job:
$ curl -u admin:admin -H "Accept: application/json" -X GET \ 'https://bamboo825.mydomain.net/rest/api/latest/plan/ABC-DFG?expand=stages.stage.plans.plan' \ | jq '.stages.stage | .[].plans.plan | .[].planKey | .jobKey = ( .key | split("-") | .[2])'{"key": "ABC-DFG-JOB1","jobKey": "JOB1"}{"key": "ABC-DFG-FJ","jobKey": "FJ"}{"key": "ABC-DFG-P4C","jobKey": "P4C"}{"key": "ABC-DFG-HW","jobKey": "HW"}
Best regards,
Eduardo AlvarengaAtlassian Support APAC
--please don't forget to Accept the answer if the reply is helpful--
It looks like you're new here. Sign in or register to get started.