对Bitbucket Server进行REST API调用并尝试传递JSON有效负载会导致错误

时间:2018-08-21 22:06:56

标签: json curl bitbucket bitbucket-server

我正在尝试对Bitbucket Server进行其余的API调用以删除请求请求。我正在尝试在一行curl命令中完成所有操作,但是在尝试通过-d标志传递json负载时遇到错误。你能帮忙吗?

BitBucket中的其他API指令要求通过

此请求必须提供包含拉取请求版本的正文。 {     “版本”:1 }

我的命令:

curl -u'user:password'-H“内容类型:application / json” -d \'{“ version”:0} \'-X DELETE“ https://bitbucketaddress.com/rest/api/1.0/projects/PROJECT/repos/test-repo/pull-requests/19

我遇到的错误:

{“错误”:[{“上下文”:null,“消息”:“意外字符('”(代码39)):预期为有效值(数字,字符串,数组,对象,“真”, 'false'或'null')\ n [来源:com.atlassian.stash.internal.web.util.web.CountingServletInputStream@5ba3ef6e;第1行,第2列]“,” exceptionName“:” org.codehaus .jackson.JsonParseException“}]}

1 个答案:

答案 0 :(得分:5)

我认为您的报价略有下降。试试:

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

-d "{'version':0}"

相反?