Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

This endpoint does not support token-based authentication

Abbas Mohammed September 7, 2023

I am trying to compare 2 branches of particular repository.  It is giving error "This endpoint does not support token-based authentication"

the rest end point is : https://bitbucket.org/<id>/<repo_name>/branches/compare/<bramcn_name>%0Ddevelop

I have passed token and content type in to header.  The same is worked for other endpoints.

headers = {"Accept": "application/json","Authorization": 'Bearer '+bearer}
Kindly help!

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 8, 2023

Hi @Abbas Mohammed,

The URL that you posted can be used to compare two branches from browser. I'm afraid that it is not a REST API endpoint, which I believe is the reason for the error you get.

If you would like to get the diff of two branches via REST API, you can use the following endpoint:

This is for comparing commits and branches as well. If you want to compare two branches, then the URL should look as follows:

https://api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/diff/feature..main

where

workspace-id replace with the id of the workspace where the repo belongs
repo-slug replace with the slug of this repo
feature replace with the name of the source branch
main replace with the name of the destination branch

Please feel free to let me know how it goes and if you have any questions.

Kind regards,
Theodora

Abbas Mohammed September 12, 2023

Thanks,  it is working fine. 

As I need to know whether source branch is merged to destination or not, I used /diffstat/

i.e., 

base_url/<repo>/diffstat/<source_branch>..destination_branch
with the response,  I am comparing 
len(res['values'])==0=> merged else not merged.
Is there any alternate to check whether source branch is merged to destination branch or not?
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 12, 2023

Hi Abbas,

Thank you for the update! It's good to hear that it is working well for you.

There is no other endpoint that provides this info for branches. You can get that info for a specific pull request from this endpoint, but for branches you can use the diffstat one.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events