Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

REST API request-changes

Lior Mizrahi October 29, 2021

Hey,

after setting the user  with permissions to pullrequest:write the end point: 

/2.0/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/request-changes

using post returns 400 something went wrong.

all other end points that i use seem to work fine.

the user is using a app password.

any suggestions why?

i noticed you have : "Check that no changes are requested" as well as "Reset requested changes when the source branch is modified" perhaps i need to turn these on?

3 answers

0 votes
Lior Mizrahi November 4, 2021

ok i understand what i did wrong. i was sending a wrong header.

i was using: {"Content-Type": "application/json"}

instead of: {'Accept': 'application/json'}

hence the bad request.

BUT

if the pull request was created by the same user as the user that is sending the api call it just returns a success without informing that nothing really happened because the pull request is owned by same user. i think api should either return failure or some sort of message that states that this is an invalid request because the PR is owned by same user or api should allow it that the owner of the PR can also request changes.

 

regards, Lior.

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 7, 2021

Hi @Lior Mizrahi

Glad to hear that you were able to locate the issue with the request.

Can you share with me the full cURL command and header user use so I can reproduce it? I did try on my end using application/json and was unable to reproduce it as it return a bad request error on my test.

I look forward to hearing from you.

Cheers,
Syahrul

0 votes
Lior Mizrahi November 1, 2021

as stated,

the user has both "write access" and "merge via pull request" access types on the branch.

it is using a a app password to communicate via rest api.

for some reason all other end points seem to work fine except this one.

i'm not sure why but i'm getting a "something went wrong response"

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 2, 2021

Hi @Lior Mizrahi 

Thanks for the update.

I am unable to reproduce the issue on my end with the same behavior. I am leaning towards user API calls, maybe a Bad request on the body or the endpoint since 400 error means we receive a bad request.

Would it be possible for you to share user API calls so I can review them? Please mask/remove any unnecessary information before sharing.

Cheers,
Syahrul

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

Hi @Lior Mizrahi 

Welcome to the community.

Could you share with me how you configure the user permission to pull requests? I want to try reproducing this issue so it'd be great if you can share the steps you took from granting the user permission and running the API endpoint.

I look forward to hearing from you.

Cheers
Syahrul

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events