gpt4 book ai didi

cURL 中未定义 Json

转载 作者:行者123 更新时间:2023-12-04 04:51:53 24 4
gpt4 key购买 nike

我需要在 Jira 中自动插入问题,所以我需要使用 REST API,我从命令行运行 curl,这是我的命令

C:\WINDOWS\system32>curl.exe -D- -u fred:fred -X POST --data { "fields": {"project": { "key"="ZZZ-180" }, "summary": "REST TESTING" , "description": "Creation of a testing issue" , "issuretype" { "name": "Bug"}}} -H "Content-Type: application/json" http://ABCD.com:XXXX/rest/api/2/issue/

这是我收到的:
curl: (6) Could not resolve host: fields
curl: (3) [globbing] unmatched brace at pos 10
curl: (3) [globbing] unmatched brace at pos 2
curl: (6) Could not resolve host: key=
curl: (6) Could not resolve host: ZZZ-180
curl: (3) [globbing] unmatched close brace/bracket at pos 1
curl: (6) Could not resolve host: summary
curl: (6) Could not resolve host: REST TESTING
curl: (6) Could not resolve host: ,
curl: (6) Could not resolve host: description
curl: (6) Could not resolve host: Creating of a testing issue
curl: (6) Could not resolve host: ,
curl: (6) Could not resolve host: issuretype
curl: (3) [globbing] unmatched brace at pos 2
curl: (6) Could not resolve host: name
curl: (3) [globbing] unmatched close brace/bracket at pos 4

谁能帮我让 cURL 定义写入数据的 JSON 代码?

最佳答案

您必须引用字符串,但最简单的方法是将 JSON 数据放入文件并要求 cURL 从中读取:

C:\WINDOWS\system32>curl.exe -D- -u fred:fred -X POST --data @data_to_send.json -H "Content-Type: application/json" http://ABCD.com:XXXX/rest/api/2/issue/

请注意 @在文件名之前。

关于cURL 中未定义 Json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17320904/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com