Forums

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

api to compare two tags and retrive the details

daneshrao October 9, 2019

how to compare two tags in a bitbucket server repo with api and retrive what all the informations affected between two tags

1 answer

1 vote
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 16, 2019

Hi @daneshrao

We don't have an API to compare tags directly, but you can use a sequence of steps to get the information you need using multiple requests.

General steps:

  1. Get the commit associated with each tag using the following request:
    curl -u <USER>:<PASSWORD> \
    -X GET  <BITBUCKER_URL>/rest/api/1.0/projects/<PROJECT>/repos/<REPO_SLUG>/tags/<TAG> \
    You will need to run it one time for each tag and get the content for latestCommit field.
  2. Once you have the commits for each of the tags you can run the following requests to get the changes/diffs as necessary.
    curl -u <USER>:<PASSWORD> \
    -X GET <BITBUCKER_URL>/rest/api/latest/projects/<PROJECT>/repos/<REPO_SLUG>/changes?since=<FIRST_COMMIT_HASH>&until=<SECOND_COMMIT_HASH>'

    curl -u <USER>:<PASSWORD> \
    -X GET <BITBUCKER_URL>/rest/api/latest/projects/<PROJECT>/repos/<REPO_SLUG>/diff?since=<FIRST_COMMIT_HASH>&until=<SECOND_COMMIT_HASH>'

I hope that is what you are looking for.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events