curl发送默认内容类型为的POST请求
application/x-www-form-urlenpred。如果要发送JSON请求,则必须指定正确的内容类型标头:
$ curl -vX POST http://server/api/v1/places.json -d @testplace.json --header "Content-Type: application/json"
但这仅在服务器接受json输入的情况下有效。将
.json在URL的末尾可能仅表明 输出 是JSON,这并不一定意味着它也将处理JSON 输入
。API文档应提示您是否这样做。
究其原因,你得到了
401,而不是其他一些错误可能是因为服务器不能提取
auth_token从您的要求。



