Forums

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

Calling List changes in a pull request through the API returns nothing

Andrew Hammerstone
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 21, 2024

Hi, I am currently calling the rest api to get a diff for pull requests. However, when I call the diff or difftstat on a PR it returns nothing. No error message just 0 bytes returned. Other calls such as list comments on the same PR work, and I've checked my permissions for the auth token.

Here is the call I am making to test; nothing is returned.

 

curl --request GET \
  --url 'https://api.bitbucket.org/2.0/repositories/<project>/<repo>/pullrequests/25/diff' \
  --header 'Authorization: Bearer '"$AUTH"'' \
  -o output.json

 

The Bitbucket Cloud REST API

1 answer

0 votes
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 22, 2024

G'day, @Andrew Hammerstone 

Welcome to the community!

I believe the URL is incorrect, instead of the project it should be your workspace id for example my workspace name is bitbucket.org/abcd:

curl --request GET \
  --url 'https://api.bitbucket.org/2.0/repositories/abcd/<reponame>/pullrequests/25/diff' \
  --header 'Authorization: Bearer '"$AUTH"'' \
  -o output.json

I hope this helps.

Regards,
Syahrul

Andrew Hammerstone
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 25, 2024

That is what I am currently using I should have called it <workspace> over <project>.

The comments call works fine and returns data, the diff call returns 0 bytes.

 

 'https://api.bitbucket.org/2.0/repositories/myspace/myrepo/pullrequests/40/diff'

 

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 27, 2024

Hi @Andrew Hammerstone 

Can you share your request commands so I can quickly check them? You can replace them with <bracket> for sensitive information.

Regards,
Syahrul

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events