Hello, using the Bitbucket CLOUD API:
Thanks in advance for any pointers!
Hi Paolo and welcome to the community!
You can use the following API endpoint with the branches of the PR and without the topic query parameter
Example:
https://api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/diffstat/feature..main
For the conflicted files, you will see in the output the field "status": "merge conflict".
The topic query parameter was introduced last year when we made changes in the diff algorithm we use:
The status "merge conflict" was not added as a status when the topic query is used, because we will eventually remove this status. When we do, we will provide a public conflict API endpoint for customers who use this status for that purpose, to ensure continuity.
Any changes in the API are announced here:
Kind regards,Theodora
Hi @Paolo.Ascari ,
me again
There is a Bitbucket cloud API endpoint that merges a PR [1]. I am not sure if you could swap the POST method with a GET and see if you get the mergeability status?
Would be interesting, I haven't tried this yet.
Best, Ulrich
[1] https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/#api-repositories-workspace-repo-slug-pullrequests-pull-request-id-merge-post
Hello Theodora, and thank you for your prompt reply.
This!... Exactly what I was looking for!
But please let me ask you: is there a more comprehensive documentation detailing payloads and responses, including for example the 'status' field that you have mentioned and its possible values?
I have found the API documentation to be fairly basic, to be honest, sometimes with broken links or poorly formatted examples. I guess many things can be discovered through trial-and-error attempts, but it would be nice to have a richer/better documentation to peruse -- and avoid me asking you silly questions...
Cheers, Paolo
Hi Paolo,
That is the official documentation for our APIs. I just realized I provided the link to the diff endpoint instead of the diffstat, I edited my previous post to correct the URL.
While viewing info for this endpoint, scroll down to the section Responses (right below Example) > select Paginated Diff Stat, and a new window will open with details on the fields that are returned from this endpoint:
If you scroll down this window, select Diff Stat (right below the field values) and you will see more fields documented (including the field status).
Please keep in mind that the status "merge conflict" is not documented there, because, as I mentioned, we will eventually remove it (it is also not available when using the topic query parameter).
Thank you Theodora
Yes, I was looking for "merge conflict" as a possible value for the status field, but now I understand why it's not listed -- hopefully the new public conflict API endpoint will be available soon
Cheers,
Paolo
It looks like you're new here. Sign in or register to get started.