Autodesk Forge Data Manager Api 重命名项目 [英] Autodesk Forge Data Manager Api rename a Item

查看:22
本文介绍了Autodesk Forge Data Manager Api 重命名项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用这个补丁 PATCH API 来更新版本名称,技巧是你需要URL 编码端点中的版本 ID,你可以使用任何工具,例如

I'm tried to use this PATCH Api to rename item of "A360". It returns 200 with DisplayName updated, but on myhub.autodesk360.com the item seems rendered with "Name" property of json object "Included".

this is the request body :

{
"jsonApi": {
    "version": "1.0"
},
"data": {
    "id": "urn:adsk.wipprod:dm.lineage:tMqu2aQEToa3XsRmKzTTRg",
    "type": "items",
    "attributes": {
        "displayName": "new_item",
        "name" : "new_item"
    }
}

this is the response :

"data":    {
  "type": "items",
  "id": "urn:adsk.wipprod:dm.lineage:tMqu2aQEToa3XsRmKzTTRg",
  "attributes":       {
     "displayName": "new_item",
     "createTime": "2017-10-25T09:04:35.0000000Z",
     "createUserId": "QY23PAJ2YB4G",
     "createUserName": "bot@autodesk360.com",
     "lastModifiedTime": "2017-11-30T09:00:46.0000000Z",
     "lastModifiedUserId": "AYLNNU3UK324",
     "lastModifiedUserName": "Giuseppe Signorelli",
     "hidden": false,
     "extension":          {
        "type": "items:autodesk.core:File",
        "version": "1.0",
        "schema": {"href": "https://developer.api.autodesk.com/schema/v1/versions/items:autodesk.core:File-1.0"},
        "data": {}
     }
  }

and object included :

"included": [   {
  "type": "versions",
  "id": "urn:adsk.wipprod:fs.file:vf.tMqu2aQEToa3XsRmKzTTRg?version=2",
  "attributes":       {
     "name": "House Design.rvt",
     "displayName": "House Design.rvt",
     "createTime": "2017-11-09T16:50:30.0000000Z",
     "createUserId": "AYLNNU3UK324",
     "createUserName": "gsignorelli@tierratelematics.com",
     "lastModifiedTime": "2017-11-09T16:50:34.0000000Z",
     "lastModifiedUserId": "",
     "lastModifiedUserName": "",
     "versionNumber": 2,
     "mimeType": "application/vnd.autodesk.revit",
     "storageSize": 12550144,
     "fileType": "rvt",
     "extension":          {
        "type": "versions:autodesk.core:File",
        "version": "1.0",
        "schema": {"href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.core:File-1.0"},
        "data": {}
     }
  }

I expected that on my client show same result that A360 shows.

解决方案

If I understand correctly, you are trying to use PATCH API to rename the item name of BIM360 Docs, right? As far as I know, currently, PATCH APIs are only working on A360, they are not currently supported or encouraged for BIM 360 Docs. There might be a chance that allows for a folder rename, but it does not properly update the Docs database. So we do not recommend to use that APIs for BIM 360 Docs, and if you want to change a file name, I suggest you to upload a new version instead.

If you want to update the file name in A360, you should use PATCH API to a version, not an item. Here is what I tried, and the name of the file version is updated correctly: PATCH API to update the name of the version, the trick thing is that you need to URL encode the version id in the endpoint, you can use any tools like https://meyerweb.com/eric/tools/dencoder/ to do that. This is different as the PATCH API to item.

Once you get the 200 status, your file name should be updated correctly in A360 as shown in the following picture:

这篇关于Autodesk Forge Data Manager Api 重命名项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆