内容类型application / json导致415 Unsupported Media Type

时间:2017-03-15 02:22:22

标签: autodesk-forge autodesk-data-management

我正在测试Forge API,除了GET Hub之外,我已经能够顺利完成大多数端点的请求 - 我不断获得415不支持的媒体类型。

奇怪的是,在删除Content-Type标头后 - 这是与Content-Type:application/json的所有其他端点使用的标头相同 - 请求有效并返回带有正确数据的200.

是否有关于我不熟悉的内容类型的内容? 第一次请求不应该起作用吗?

请求1 - 为集线器端点返回415:无数据
GET https://developer.api.autodesk.com/project/v1/hubs HTTP/1.1
Host: developer.api.autodesk.com
Authorization: Bearer {{ACCESS_TOKEN}}
Content-Type: application/json
Cache-Control: no-cache
请求2 - 返回200:数据正常
GET https://developer.api.autodesk.com/project/v1/hubs HTTP/1.1
Host: developer.api.autodesk.com
Authorization: Bearer {{ACCESS_TOKEN}}
Cache-Control: no-cache

Request 1 Request 2

2 个答案:

答案 0 :(得分:1)

JSON API定义客户端必须发送const { children } = this.props React.Children.forEach(children, element => { if (!React.isValidElement(element)) return const { source } = element.props //do something with source.. })

答案 1 :(得分:0)

根据评论回答我自己的问题(感谢@ chetan-ranpariya)

  1. 您不需要在GET请求上传递内容类型
  2. API应该忽略标题;问题已报告给API团队