1

I am trying to make rest API call to Bitbucket Server to delete a pull request. I am trying to do it all in one line curl command but getting an error when trying to pass json payload with -d flag. Can you please help.

Rest API instructions in BitBucket instruct to pass

A body containing the version of the pull request must be provided with this request. { "version": 1 }

My command:

curl -u 'user:password' -H "Content-Type: application/json" -d \'{"version":0}\' -X DELETE "https://bitbucketaddress.com/rest/api/1.0/projects/PROJECT/repos/test-repo/pull-requests/19"

Error that I am getting:

{"errors":[{"context":null,"message":"Unexpected character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: com.atlassian.stash.internal.web.util.web.CountingServletInputStream@5ba3ef6e; line: 1, column: 2]","exceptionName":"org.codehaus.jackson.JsonParseException"}]}

1 Answer 1

5

I think your quotes are a little off. Try:

-d "{\"version\":0}"

or

-d "{'version':0}"

instead?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.