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

Delete pull request from repo via API

sai kumar September 28, 2020

I am trying to delete the Pull request from repo where as i am getting 405 error.

curl -vvv -s -H "Authorization: Bearer $API-TOKEN" -X DELETE "https://code.server.com/stash/rest/api/1.0/projects/~skumar/repos/test/pull-requests?$PRID" --header "Content-Type: application/json" -H "Accept: application/json"  --data '{ "version": "'"$PRVERSION"'" }'  getting error 405, (The request HTTP method is not appropriate for the targeted resource)  < allow: HEAD,POST,GET,OPTIONS.

I gave the values instead of variables. still got the same error. 

Environment: Server version 6.6.4.

as per the api-document document, I can delete, where as i am getting 405 error.  allowed methods are HEAD,POST,GET,OPTIONS. I am the owner of the repo and have admin privileges.

1 answer

1 vote
Christian Glockner
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 30, 2020

Hi Sai,

The pull request ID needs to be provided as part of the path, not as a query string - try something like this instead:

curl -vvv -s -H "Authorization: Bearer $API-TOKEN" -X DELETE "https://code.server.com/stash/rest/api/1.0/projects/~skumar/repos/test/pull-requests/$PRID" --header "Content-Type: application/json" -H "Accept: application/json"  --data '{ "version": "'"$PRVERSION"'" }'

Cheers,

Christian

Premier Support Engineer

Atlassian

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events