Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

REST API request-changes

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

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.
Nov 07, 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

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.
Nov 02, 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.
Oct 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