【发布时间】:2012-08-02 13:13:52
【问题描述】:
我们可以通过以下方式获取 XML 数据
curl -v --basic --user USERNAME:PASSWORD --request POST "http://teamcity:8111/httpAuth/app/rest/users/" --data @data.xml --header "Content-Type: application/xml"
我们可以对 JSON 做同样的事情吗?
curl -v --basic --user USERNAME:PASSWORD --request POST "http://teamcity:8111/httpAuth/app/rest/users/" --data @data.json --header "Content-Type: application/json"
两者,返回
HTTP/1.1 200 正常 日期:2012 年 8 月 5 日星期日 02:18:36 GMT 服务器:Apache-Coyote/1.1 Pragma:无缓存 过期:1970 年 1 月 1 日星期四 00:00:00 GMT 缓存控制:无缓存 缓存控制:无存储 内容类型:应用程序/xml因此,内容类型:xml
如何获取 JSON 响应。
【问题讨论】: