[英]Autodesk Forge API. How to get specific version of item?
I'm to get a specific version of the item from the Autodesk Forge.我要从 Autodesk Forge 获取该项目的特定版本。 I use this instruction to do it.
我使用这个指令来做到这一点。 There is a template of a request:
有一个请求模板:
GET projects/:project_id/versions/:version_id/item
So my request look similar (I cuted out a part for brevity):所以我的请求看起来很相似(为了简洁,我剪掉了一部分):
https://developer.api.autodesk.com/data/v1/projects/a.cGV ... TU2/versions/urn:adsk.wipprod:fs.file:vf.lTvo5GGBRzidiQ8Kredbaw?version=1/item
But the request returns error 400 (Bad request).但是请求返回错误 400 (错误请求)。
When I just get the itemin the same way (using an intended for this template of course) all is okay.当我以相同的方式(当然使用用于此模板的预期)获取项目时,一切正常。
Should I to use this template or other?我应该使用这个模板还是其他模板? What am I doing wrong?
我究竟做错了什么?
The version_id
should be escaped into a URL safe form since there are some reserved and unsafe keywords ( ie :
, .
, ?
and =
) in this parameter. version_id
应该转义为 URL 安全形式,因为此参数中有一些保留和不安全的关键字(即:
、 .
、 ?
和=
)。 They will invalid your request to the Forge service.他们将使您对 Forge 服务的请求无效。 ( Ref )
(参考)
For example, your version_id is urn:adsk.wipprod:fs.file:vf.d34fdsg3g?version=2
, then you have to tranform it like:例如,您的 version_id 是
urn:adsk.wipprod:fs.file:vf.d34fdsg3g?version=2
,那么您必须将其转换为:
urn%3Aadsk.wipprod%3Afs.file%3Avf.b909RzMKR4mhc3O7UBY_8g%3Fversion%3D2
. urn%3Aadsk.wipprod%3Afs.file%3Avf.b909RzMKR4mhc3O7UBY_8g%3Fversion%3D2
。
In JavaScript, the encodeURIComponent()
( Ref ) function can help you do this transformation.在 JavaScript 中,
encodeURIComponent()
( Ref ) 函数可以帮助您进行这种转换。 Here is a sample for you:这是给您的示例:
encodeURIComponent('urn:adsk.wipprod:fs.file:vf.d34fdsg3g?version=2')
If your codes are written in C#, you can call Uri.EscapeDataString()
( Ref ) to archive the same goal.如果您的代码是用 C# 编写的,您可以调用
Uri.EscapeDataString()
( Ref ) 来存档相同的目标。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.