Soundcloud根据请求使用json而不是xml进行回复

时间:2012-04-11 14:53:31

标签: curl libcurl soundcloud

为响应我对授权令牌的请求,Soundcloud正在使用json字符串进行回复,尽管我要求使用xml。这是一个错误,还是没有实现,或者我做错了什么?

我在下面的“详细”模式中发布了libcurl的输出,显示了“Accept”标题,以及以json格式返回的字符串。

> POST /oauth2/token HTTP/1.1
User-Agent: libcurl-agent/1.0
Host: api.soundcloud.com
Accept: application/xml
Content-Length: 641
Content-Type: multipart/form-data; boundary=----------------------------6d7e62ba13e0

< HTTP/1.1 200 OK
< Server: nginx
< Date: Tue, 10 Apr 2012 21:48:55 GMT
< Content-Type: application/json; charset=utf-8
< Connection: keep-alive
< X-Runtime: 44
< ETag: "62f76a251f0cdc7c41edec20560d2c04"
< Cache-Control: private, max-age=0, must-revalidate
< Access-Control-Allow-Methods: GET, PUT, POST, DELETE
< Access-Control-Allow-Headers: Accept, Authorization, Content-Type, Origin
< Access-Control-Allow-Origin: *
< X-Cacheable: NO:Cache-Control=max-age=0
< Content-Length: 133
< X-Varnish: 3363129842
< Age: 0
< Via: 1.1 varnish
< X-Cache: MISS
< 
* Connection #0 to host api.soundcloud.com left intact

Soundcloud结果:{“access_token”:“1-17690-10631-cea7e4319d85f1XXXX”,“expires_in”:21599,“scope”:“*”,“refresh_token”:“50530eb4738f285df48f3694ad49XXX​​X”}

1 个答案:

答案 0 :(得分:0)

感谢您指出这一点。目前,OAuth2令牌端点支持JSON,这与API的其余部分不一致。我将提交一个错误,希望我们可以解决这个问题。你没有做错任何事情: - )