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 Alvarenga
Atlassian Support APAC
--please don't forget to Accept the answer if the reply is helpful--
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.