大家好,我这里有一个 cURL 命令
curl -X POST https://*.com/graph/api/v1/graphql -H 'content-type:application/json' -H 'Authorization:bearer *token*' -d '{"query": "{ assets(query: { searchTerm: \"hello-world-sys-app-v1\" ,type: \"app\"}) { groupId, assetId, version, type } }"}'
这在 linux 上按预期运行并像这样返回
{"data":{"assets":[{"groupId":"*","assetId":"hello-world-sys-app-v1","version":"1.0.15-D160-B167-PERF","type":"app"},{"groupId":"*","assetId":"hello-world-sys-app-v1","version":"1.0.15-D157-B115-DEV1","type":"app"}]}}
但是,在 Windows 上运行时,我收到这样的错误
The request's Content-Type is not supported. Expected:
application/jsoncurl: (6) Could not resolve host: application
curl: (6) Could not resolve host: bearer
curl: (6) Could not resolve host: dc411cee-c007-4955-ab45-87522b2713ad'
curl: (3) [globbing] nested brace in column 17
我尝试了一些我在这里读过的解决方案,但没有运气https://superuser.com/questions/1291352/curl-command-runs-in-linux-but-not-windows-2008
我尝试了几种不同的单引号和双引号组合,但只是出现错误,我也尝试使用数据文件,但出现类似错误。我觉得这是一个简单的问题,但我似乎无法弄清楚语法。
任何帮助或想法将不胜感激!
谢谢
我现在已经在 Windows 上工作了,虽然我仍然不知道它为什么工作,但我首先用双引号替换了所有单引号,但仍然出现错误。但是在添加三个反斜杠后,我能够得到正确的响应。
curl -X POST "https://*.com/graph/api/v1/graphql" -H "content-type:application/json" -H "Authorization:bearer *" -d "{\"query\": \"{ assets(query: { searchTerm: \\\"hello-world-sys-app-v1\\\" ,type: \\\"app\\\"}) { groupId, assetId, version, type } }\"}"
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句