Jira API的curl请求中出现意外字符错误

Jira API的curl请求中出现意外字符错误,curl,jira,Curl,Jira,我试图通过在Jira API中使用curl请求来更新Jira问题中的字段,并使用来自的最后一个curl请求来创建更改票据摘要字段的请求 我使用了这个curl命令(将实际域替换为“domain”,将我的api令牌替换为“my_令牌”): 我的“data_file.json”如下所示: { "update" : { "summary" : [{"set" : "Big block Chevy"}]

我试图通过在Jira API中使用curl请求来更新Jira问题中的字段,并使用来自的最后一个curl请求来创建更改票据摘要字段的请求

我使用了这个curl命令(将实际域替换为“domain”,将我的api令牌替换为“my_令牌”):

我的“data_file.json”如下所示:

{
    "update" : {
        "summary" : [{"set" : "Big block Chevy"}]
    }
}
但我收到的错误消息是:

PS C:\Users\de00180\Desktop> curl -D- -u kim.tang@DOMAIN.com:MY_TOKEN -X PUT --data "data_file.json" -H "Content-Type: application/json" https://DOMAIN.atlassian.net/rest/api/2/issue/ZSTP-3511
HTTP/1.1 400 Bad Request
Server: AtlassianProxy/1.15.8.1
cache-control: no-cache, no-store, no-transform
Content-Type: application/json;charset=UTF-8
Strict-Transport-Security: max-age=315360000; includeSubDomains; preload
Date: Thu, 22 Oct 2020 11:00:15 GMT
ATL-TraceId: 2b748183a0112486
x-arequestid: e929fb72-6adc-4cb7-84e4-f38f36c6e342
x-aaccountid: 5aec0e222d1bf924e1fc693d
X-XSS-Protection: 1; mode=block
Transfer-Encoding: chunked
timing-allow-origin: *
x-envoy-upstream-service-time: 21
X-Content-Type-Options: nosniff
Connection: close
set-cookie: atlassian.xsrf.token=BP6L-4GZ3-UVOB-X2BO_044d61b5148f4471cb04a8c58ac8f12ab76f2fd2_lin; Path=/; Secure
Expect-CT: report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/global-proxy", enforce, max-age=86400

{"errorMessages":["Unexpected character ('d' (code 100)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@5503a2e4; line: 1, column: 2]"]}
另一个错误代码不同,试图更改引号字符对我来说不起作用

但我也在使用Windows,所以它可能与我的操作系统相连

我还查看了错误代码和错误代码,但它并没有帮助我解决这个问题,因为错误代码100只是代表Jira中的“Continue”响应


如何修复此错误?

问题可能出在实际的curl命令中。我从中了解到,如果引用文件,则需要在文件名前加一个“@”。否则,它将“data_file.json”作为实际的请求主体

试试这个:

curl -D- -u kim.tang@DOMAIN.com:MY_TOKEN -X PUT --data "@data_file.json" -H "Content-Type: application/json" https://DOMAIN.atlassian.net/rest/api/2/issue/ZSTP-3511
我最好的猜测是您的“json”格式不正确/实际上不是有效的json。您是否验证了json实际上是有效的?如果您通过jq或运行它,您会得到任何错误吗?
curl -D- -u kim.tang@DOMAIN.com:MY_TOKEN -X PUT --data "@data_file.json" -H "Content-Type: application/json" https://DOMAIN.atlassian.net/rest/api/2/issue/ZSTP-3511