I need to get pipeline data for a specific pipeline from the API https://api.bitbucket.org/2.0/repositories/leftshiftone/heimdall/pipelines/UUID.
As a starting point I just have the data coming from a webhook triggered when a pipeline is started. Unfortunately I can't find the pipeline's UUID where I could call the endpoint directly. I am also not able to filter the API call for pipelines with a certain build number.
I'm trying to avoid getting all the data as a list, but if there is no link to the pipelines from the webhook which triggered the pipeline I need to request more data and look it up in my application.
Here is the data coming from the webhook:
{
"actor": {
"username": "leftshiftone",
"display_name": "Leftshift One",
"account_id": "ACCOUNT_ID",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/leftshiftone"
},
"html": {
"href": "https://bitbucket.org/leftshiftone/"
},
"avatar": {
"href": "https://bitbucket.org/account/leftshiftone/avatar/"
}
},
"type": "user",
"nickname": "leftshiftone",
"uuid": "{cf8acba5-e91c-45b2-a4ba-ef99e180f9e4}"
},
"repository": {
"scm": "git",
"website": "",
"name": "test1",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/leftshiftone/test1"
},
"html": {
"href": "https://bitbucket.org/leftshiftone/test1"
},
"avatar": {
"href": "https://bytebucket.org/ravatar/%7Beb501d9b-aed2-4454-9f7d-7d3eea7436b9%7D?ts=1979072"
}
},
"full_name": "leftshiftone/test1",
"owner": {
"username": "leftshiftone",
"display_name": "Leftshift One",
"account_id": "ACCOUNT_ID",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/leftshiftone"
},
"html": {
"href": "https://bitbucket.org/leftshiftone/"
},
"avatar": {
"href": "https://bitbucket.org/account/leftshiftone/avatar/"
}
},
"type": "user",
"nickname": "leftshiftone",
"uuid": "{cf8acba5-e91c-45b2-a4ba-ef99e180f9e4}"
},
"type": "repository",
"is_private": true,
"uuid": "{eb501d9b-aed2-4454-9f7d-7d3eea7436b9}"
},
"commit_status": {
"links": {
"commit": {
"href": "https://api.bitbucket.org/2.0/repositories/leftshiftone/test1/commit/36b912f63ea5e1190a7a1f0e4e6427d4669cb91e"
},
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/leftshiftone/test1/commit/36b912f63ea5e1190a7a1f0e4e6427d4669cb91e/statuses/build/-1081267614"
}
},
"repository": {
"full_name": "leftshiftone/test1",
"type": "repository",
"name": "test1",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/leftshiftone/test1"
},
"html": {
"href": "https://bitbucket.org/leftshiftone/test1"
},
"avatar": {
"href": "https://bytebucket.org/ravatar/%7Beb501d9b-aed2-4454-9f7d-7d3eea7436b9%7D?ts=1979072"
}
},
"uuid": "{eb501d9b-aed2-4454-9f7d-7d3eea7436b9}"
},
"url": "https://bitbucket.org/leftshiftone/test1/addon/pipelines/home#!/results/113",
"refname": "master",
"name": "Pipeline #114 for master",
"state": "INPROGRESS",
"key": "-1081267614",
"updated_on": "2018-11-30T21:26:48.375063+00:00",
"commit": {
"hash": "36b912f63ea5e1190a7a1f0e4e6427d4669cb91e",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/leftshiftone/test1/commit/36b912f63ea5e1190a7a1f0e4e6427d4669cb91e"
},
"comments": {
"href": "https://api.bitbucket.org/2.0/repositories/leftshiftone/test1/commit/36b912f63ea5e1190a7a1f0e4e6427d4669cb91e/comments"
},
"patch": {
"href": "https://api.bitbucket.org/2.0/repositories/leftshiftone/test1/patch/36b912f63ea5e1190a7a1f0e4e6427d4669cb91e"
},
"html": {
"href": "https://bitbucket.org/leftshiftone/test1/commits/36b912f63ea5e1190a7a1f0e4e6427d4669cb91e"
},
"diff": {
"href": "https://api.bitbucket.org/2.0/repositories/leftshiftone/test1/diff/36b912f63ea5e1190a7a1f0e4e6427d4669cb91e"
},
"approve": {
"href": "https://api.bitbucket.org/2.0/repositories/leftshiftone/test1/commit/36b912f63ea5e1190a7a1f0e4e6427d4669cb91e/approve"
},
"statuses": {
"href": "https://api.bitbucket.org/2.0/repositories/leftshiftone/test1/commit/36b912f63ea5e1190a7a1f0e4e6427d4669cb91e/statuses"
}
},
"author": {
"raw": "Michael Mair <michael.mair@leftshift.one>",
"type": "author",
"user": {
"username": "mmair",
"display_name": "Michael Mair",
"account_id": "557058:2c85c071-c22a-457c-89a3-49f199508f91",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/mmair"
},
"html": {
"href": "https://bitbucket.org/mmair/"
},
"avatar": {
"href": "https://bitbucket.org/account/mmair/avatar/"
}
},
"type": "user",
"nickname": "mmair",
"uuid": "{9ab452a4-889e-4336-8d56-5164b3810917}"
}
},
"date": "2018-11-30T17:56:39+00:00",
"message": "[GAIA-384] (button+submit) added attributes to RAIN request\n",
"type": "commit"
},
"type": "build",
"created_on": "2018-11-30T17:57:05.815227+00:00",
"description": ""
}
}
Unfortunately it is not documented, but you can actually get a pipeline based on its build number.
for example: https://api.bitbucket.org/2.0/repositories/spittet/node-mysql/pipelines/1
I'll raise an issue to update the documentation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.