Hi,
While I understand these are not documented APIs I think you used to be able to get the branches associated with an issue using a call like the following:
https://alterian.atlassian.net/rest/dev-status/latest/issue/detail?issueId=119044&applicationType=bitbucket&dataType=branchThis issue has a linked commit to a particular branch so I was anticipating that this call would return that branch.Has this changed - and if so, is there any other way to get the branch information
Hi @Paul Becker ,
Even if it is an internal endpoint it still works fine. It's just that you should use details instead of detal:
https://XXXXX.atlassian.net/rest/dev-status/latest/issue/details?issueId=10196&applicationType=bitbucket&dataType=branch
Please use 'details' in the endpoint you are calling and confirm this works.
Cheers,Dario
Hi Dario. Thanks for your reply.
Using details rather than detail does give me a bit more information about the commits but still doesn't include any branch information - unless I also have a linked pull request.
As it stands I guess I would need to take the commit id and look up the branch via bitbucket, but I think you used to get the branch info directly in the branches array?
"errors": [],"detail": [{"branches": [], -- I think this used to be populated when you had an associated commit
Thanks,
Paul
I am not sure I understand correctly, but I can see branches information being returned whether I use the endpoint
/rest/dev-status/latest/issue/summary?issueId=
OR:
/rest/dev-status/latest/issue/details?issueId=
Example:
curl -v -u <EMAIL-ADDRESS>:<API-TOKEN> "https://<NAME>.atlassian.net/rest/dev-status/latest/issue/details?issueId=10196" | json_pp % Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed100 10391 0 10391 0 0 5668 0 --:--:-- 0:00:01 --:--:-- 5668{"errors": [],"detail": [{"branches": [{"name": "feature/KFF-39-test","url": "https://bitbucket.org/{}/{edcb945a-5aee-XXXXXXXXXXXX}/branch/feature/KFF-39-test","createPullRequestUrl": "https://bitbucket.org/{}/{edcb945a-XXXXXXXXXXXXXX}/pull-requests/new?source=feature/KFF-39-test","repository": {"name": "New_repo1","avatar": "https://bytebucket.org/ravatar/{edcb945XXXXXXXXXXXXXXXX7}?ts=default","url": "https://bitbucket.org/{}/{edcb945a-5aee-44XXXXXXXXXXXX06d07}","commits": []},"lastCommit": {"id": "2847fb7981b1b0e0XXXXXXXXXXXX88085f4","displayId": "2847fb7","authorTimestamp": "2020-02-12T13:15:15.000+0000","merge": false,"files": []}}],
curl -v -u <EMAIL-ADDRESS>:<API-TOKEN> "https://<NAME>.atlassian.net/rest/dev-status/1.0/issue/summary?issueId=10196" | json_pp% Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed100 1116 0 1116 0 0 2364 0 --:--:-- --:--:-- --:--:-- 2359{"errors" : [],"summary" : {"deployment-environment" : {"overall" : {"showProjects" : false,"successfulCount" : 0,"count" : 0,"lastUpdated" : null,"dataType" : "deployment-environment","topEnvironments" : []},"byInstanceType" : {}},"branch" : {"byInstanceType" : {"bitbucket" : {"name" : "Bitbucket Cloud","count" : 1}},"overall" : {"count" : 1,"dataType" : "branch","lastUpdated" : "2020-02-12T14:15:15.000+0100"}},
Can you kindly perform the same tests, share what you get and provide a bit more details on what would you expect to see instead?
Hi Dario,
Maybe I am misunderstanding now a branch gets linked to a JIRA issue. I had assumed that a linked commit would also cause its branch to be linked? Do I have to do something extra to link the branch?I get the following:
https://alterian.atlassian.net/rest/dev-status/latest/issue/details?issueId=115254&applicationType=bitbucket&dataType=branch
{"errors":[],"detail":[{"branches":[],"pullRequests":[{"author":{"name":"Tim Shire","avatar":"https://secure.gravatar.com/avatar/94aa4d7ae2f0369ec1ba193d5bbd293d?d=https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TS-1.png&size=48&s=48"},"id":"220","name":"dev-800 Initiatives API's (Create / Get / Edit / Delete)","commentCount":0,"source":{"branch":"feature/dev-800","url":"https://bitbucket.org/{}/{d4907970-2144-4d6a-9e4a-d14f89eac08a}/branch/feature/dev-800"},"destination":{"branch":"master","url":"https://bitbucket.org/{}/{d4907970-2144-4d6a-9e4a-d14f89eac08a}/branch/master"},"reviewers":[{"name":"Paul Becker","avatar":"https://secure.gravatar.com/avatar/55daf92e9d032ca50ba85aca6fbea6c6?d=https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/PB-6.png&size=48&s=48","approved":false}],"status":"DECLINED","url":"https://bitbucket.org/{}/{d4907970-2144-4d6a-9e4a-d14f89eac08a}/pull-requests/220","lastUpdate":"2020-02-19T10:01:50.524+0000"}],"repositories":[],"_instance":{"singleInstance":true,"baseUrl":"https://bitbucket.org","name":"Bitbucket","typeName":"Bitbucket Cloud","id":"bitbucket","type":"bitbucket"}},{"repositories":[{"name":"Campaign Manager","avatar":"https://bytebucket.org/{}/{d4907970-2144-4d6a-9e4a-d14f89eac08a}/avatar","url":"https://bitbucket.org/{}/{d4907970-2144-4d6a-9e4a-d14f89eac08a}","commits":[{"id":"16c77aa90ef9ef5719d818b140ade0c930f53a5e","displayId":"16c77aa","authorTimestamp":"2020-02-17T11:13:38.000+0000","url":"https://bitbucket.org/{}/{d4907970-2144-4d6a-9e4a-d14f89eac08a}/commits/16c77aa90ef9ef5719d818b140ade0c930f53a5e","author":{"name":"Paul Becker","avatar":"https://secure.gravatar.com/avatar/55daf92e9d032ca50ba85aca6fbea6c6?d=https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/PB-6.png&size=48&s=48"},"fileCount":1,"merge":false,"message":"DEV-800 Add new stored procs to project\n","files":[{"path":"Database/Database.sqlproj","url":"https://bitbucket.org/{}/{d4907970-2144-4d6a-9e4a-d14f89eac08a}/commits/16c77aa90ef9ef5719d818b140ade0c930f53a5e#chg-Database/Database.sqlproj","changeType":"MODIFIED","linesAdded":6,"linesRemoved":0}]}]}],"_instance":{"singleInstance":true,"baseUrl":"https://bitbucket.org","name":"Bitbucket","typeName":"Bitbucket Cloud","id":"bitbucket","type":"bitbucket"}}]}
and for:
https://alterian.atlassian.net/rest/dev-status/latest/issue/summary?issueId=115254
"errors":[],"configErrors":[],"summary":{"pullrequest":{"overall":{"count":1,"lastUpdated":"2020-02-19T10:01:50.524+0000","stateCount":1,"state":"DECLINED","dataType":"pullrequest","open":false},"byInstanceType":{"bitbucket":{"count":1,"name":"Bitbucket Cloud"}}},"build":{"overall":{"count":0,"lastUpdated":null,"failedBuildCount":0,"successfulBuildCount":0,"unknownBuildCount":0,"dataType":"build"},"byInstanceType":{}},"review":{"overall":{"count":0,"lastUpdated":null,"stateCount":0,"state":null,"dueDate":null,"overDue":false,"dataType":"review","completed":false},"byInstanceType":{}},"deployment-environment":{"overall":{"count":0,"lastUpdated":null,"topEnvironments":[],"showProjects":false,"successfulCount":0,"dataType":"deployment-environment"},"byInstanceType":{}},"repository":{"overall":{"count":1,"lastUpdated":"2020-02-17T11:13:38.000+0000","dataType":"repository"},"byInstanceType":{"bitbucket":{"count":1,"name":"Bitbucket Cloud"}}},"branch":{"overall":{"count":0,"lastUpdated":null,"dataType":"branch"},"byInstanceType":{}}
It looks like you're new here. Sign in or register to get started.