错误的要求:使用curl时缺少要求正文

时间:2019-06-06 09:25:21

标签: http curl

当尝试使用curl查询PUT命令时,出现以下错误: "error":"bad_request","reason":"Missing request body"

这是我试图执行的查询以在数据库中插入新文档:

curl -X PUT  http://127.0.0.1:5984/mychannel_fabcar/CAR10/  '{"docs" : [ "_id": "CAR10", "colour": "white","make": "Ford", "model": "Figo","owner": "Meghna","~version": "\u0000CgMBAgA="]}'

1 个答案:

答案 0 :(得分:1)

您不应该为身体提供选项-d吗?

curl -X PUT   http://127.0.0.1:5984/mychannel_fabcar/CAR10/  -d '{"docs": [ "_id": "CAR10", "colour": "white","make": "Ford", "model":"Figo","owner": "Meghna","~version": "\u0000CgMBAgA="]}'

有关详细说明,请参见this thread(上传文件)和this thread(上传原始数据)。