【问题标题】:Issues with sending JSON Payload using Curl through command line / Shell. The same works well when using a Json file通过命令行/Shell 使用 Curl 发送 JSON 有效负载的问题。使用 Json 文件时同样有效
【发布时间】:2016-12-09 12:05:07
【问题描述】:

我遇到了一个问题,我尝试使用终端通过 curl 将 JSON 有效负载发送到服务器

curl -v -u admin:admin123 --header "Content-Type: application/json" 'http://localhost:8080/service/siesta/rest/v1/script/' -d '{"name": "trg_dao","type": "groovy","content ": "blobStore.createFileBlobStore('trg_dao','/tmp/trg_dao')"}' 然后上传为

{ “名称”:“trg_dao”, “内容”:“blobStore.createFileBlobStore(trg_dao,/tmp/trg_dao)”, “类型”:“时髦” }

使用 -d @filename (curl -v -g -u admin:admin123 --header "Content-Type: application/json" 'http://localhost:8080/service/siesta/rest/v1/script/' --data-二进制@test.json)

{ “名称”:“trg_dao”, “内容”:“blobStore.createFileBlobStore('trg_dao','/tmp/trg_dao')”, “类型”:“时髦” }

我使用的有效载荷是

{"name": "trg_dao","type": "groovy","content": "blobStore.createFileBlobStore('trg_dao','/tmp/trg_dao')"}

任何关于我哪里出错的指示都会非常有帮助。

最好的问候 湿婆

【问题讨论】:

    标签: json curl


    【解决方案1】:

    我已经解决了如下问题

    curl -v -u admin:admin123 -H "Content-type: application/json" -d '{"name": "trg_dao","type": "groovy","content": "blobStore.creaileBlobStore ('"'trg_dao'"','"'/tmp/trg_dao'"')"}' 'http://localhost:8080/v1/script/'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-28
      • 1970-01-01
      • 2020-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多