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

Dze*_*lig 1 json curl bitbucket bitbucket-server

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

BitBucket中的其余API指令指示传递

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

我的命令:

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

我得到的错误:

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

小智 5

我认为您的报价有些偏离。尝试:

-d "{\"version\":0}"
Run Code Online (Sandbox Code Playgroud)

要么

-d "{'version':0}"
Run Code Online (Sandbox Code Playgroud)

代替?