Autodesk Forge 上模型属性 API 中的 Axios GET 属性存在问题
我无法从 Autodesk Forge 提供的新模型属性 API 获取 [GETprojects/:projectId/diffs/:diffId/properties] 的结果。
我已经能够让所有模型属性 API 调用(索引和 Diff)在 Postman 上工作。但是,在 NodeJS 服务器(使用 axios)上,properties 调用不起作用,并返回 502 错误。
下面是示例代码:
const result = await axios.get(
`https://developer.api.autodesk.com/construction/index/v2/projects/${projectId}/diffs/${diffId}/properties`,
{
headers: {
Authorization: `Bearer ${internalToken.access_token}`,
},
},
);
如果我将 properties 替换为 manifest 或 fields,则结果会正常返回。这适用于 Index 和 Diff。
我不确定这是否实际上是内部服务器错误(即返回的错误),或者发送的请求是否有问题?
注意:如果有什么区别,那就是 BIM360 项目。
更新:经过进一步使用,当响应较大时,似乎会出现状态为“Bad Gateway”的错误 502。超过 ~14MB 的响应会返回此错误。这是确认的,因为结果在 Postman 上正常返回。
Autodesk 的任何人都可以帮我解决这个问题吗?以及是否有任何替代方案可以解决此问题。
I'm having trouble getting the results for [GET projects/:projectId/diffs/:diffId/properties] from the new Model Properties API provided by Autodesk Forge.
I've been able to get all the Model Properties API calls (both Index and Diff) to work on Postman. However, on a NodeJS server (using axios) the properties call doesn't work, and returns a 502 error.
Below is an example code:
const result = await axios.get(
`https://developer.api.autodesk.com/construction/index/v2/projects/${projectId}/diffs/${diffId}/properties`,
{
headers: {
Authorization: `Bearer ${internalToken.access_token}`,
},
},
);
If I replace properties with either manifest or fields, the results are returned normally. This applies to both Index and Diff.
I'm not sure if this is actually an internal server error (which is the error returned), or is there something wrong in the request that is being sent?
Note: if it makes any difference, it is a BIM360 project.
Update: After some further usage, it seems that the error 502 with status of 'Bad Gateway' occurs when the response is large. Responses above ~14MB return this error. This is confirmed because the results return normally on Postman.
Could anyone from Autodesk help me with this? And if there are any alternatives to fixing this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果有人遇到同样的问题,可以通过在请求的标头中添加 'Accept-Encoding': 'gzip, deflate, br' 来解决。
In case somebody runs into the same problem, it was solved by adding 'Accept-Encoding': 'gzip, deflate, br' to the header in the request.