【问题标题】:Autodesk Forge API - Patch Item Input ErrorAutodesk Forge API - 补丁项输入错误
【发布时间】:2021-12-01 07:25:15
【问题描述】:

我正在尝试使用 PATCH projects/:project_id/items/:item_id 端点来更新 BIM360 中项目的“displayName”属性。 Forge 文档中有一个关于如何做到这一点的示例,但由于某种原因,我收到了 400 错误。

这是我的有效载荷:

{
    "jsonapi": {
        "version": "1.0"
    },
    "data": {
        "type": "items",
        "id": "ITEM_URN",
        "attributes": {
            "displayName": "NEW_ITEM_NAME.EXTENSION"
        }
    }
}

这是我得到的错误:

{
    "jsonapi": {
        "version": "1.0"
    },
    "errors": [
        {
            "id": "a4c43bbb-9e34-4973-9f9c-58a7e1d7bdb6",
            "status": "400",
            "code": "BAD_INPUT",
            "title": "One or more input values in the request were bad",
            "detail": "Request input is invalid for this operation."
        }
    ]
}

我成功地使用相同的端点来更改同一项目的父文件夹(如本文回答中所述:Autodesk Forge; Pragmatically changing file location without new upload),因此问题必须在更新“displayName”部分。这里是返回 200 答案的成功负载示例:

{
    "jsonapi": {
        "version": "1.0"
    },
    "data": {
        "type": "items",
        "id": "ITEM_URN",
        "relationships": {
            "parent": {
                "data": {
                    "type": "folders",
                    "id": "DESTINATION_FOLDER_URN"
                }
            }
        }
    }
}

用示例伪造文档:https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-items-item_id-PATCH/

为了更新“displayName”属性,我缺少什么?

【问题讨论】:

    标签: autodesk-forge autodesk-bim360


    【解决方案1】:

    如果要更改文件名,可以更改提示版本名称和标题,需要创建新版本,但不必重新上传文件。请在https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-POST/ 试用 API:

    POST /versions?copyFrom={tip_version_urn}
    {
      "jsonapi": {
        "version": "1.0"
      },
      "data": {
        "type": "versions",
        "attributes": {
          "name": "newName"
        }
      }
    }
    

    将使用更新后的名称创建一个新的提示版本。

    【讨论】:

      猜你喜欢
      • 2017-03-25
      • 2018-03-20
      • 2018-05-10
      • 2021-10-24
      • 2021-04-19
      • 2017-12-15
      • 1970-01-01
      • 1970-01-01
      • 2018-09-26
      相关资源
      最近更新 更多