BIM 360无法创建现有文件的版本

时间:2020-04-23 20:35:29

标签: autodesk-forge autodesk-bim360

我正在按照here中的说明对文件进行版本控制。

我称此终结点为“ https://developer.api.autodesk.com/data/v1/projects/b.f67f2d2a-13e0-4764-9cc4-3cbb3ce4ecf8/versions

这是我要发送的json:

    "jsonapi":{"version":"1.0"},
"data":{
    "attributes":{
        "extension":{
            "type":"versions:autodesk.core:File",
            "version":"1.0"
            },
        "name":"saw.txt"
    },
    "relationships":{
        "item":{
            "data":{
                "type":"items",
                "id":"urn:adsk.wipprod:dm.lineage:LvhVsjRMRSeilxRYaO8Blw"
                }
            },
        "storage":{
            "data":{
                "type":"objects",
                "id":"urn:adsk.objects:os.object:wip.dm.prod/fb277d09-7049-4474-8762-e9a5723e1e48.txt"
                }
            }
        },
    "type":"versions"
}

我收到的回复:

{"jsonapi":{"version":"1.0"},"errors":[{"id":"7df0a3d5-376a-4607-ae7a-6726772785c4","status":"400","code":"BAD_INPUT","title":"One or more input values in the request were bad","detail":"Request input is invalid for this operation."}]}"

我知道项目ID和文件ID有效,并且创建存储桶和上传文件已成功。我还能做什么以确定版本失败的原因?

1 个答案:

答案 0 :(得分:0)

项目ID包含'b。',这表示您正在使用BIM 360文件。类型应为 versions:autodesk.bim360:File ,而不是 versions:autodesk.core:File (适用于其他类型的集线器中的文件,例如Autodesk 360)

为BIM 360文件创建版本时的演示有效负载

 {
  "jsonapi": {
    "version": "1.0"
  },
  "data": {
    "type": "versions",
    "attributes": {
      "name": "advanced.rvt",
      "extension": {
        "type": "versions:autodesk.bim360:File",
        "version": "1.0"
      }
    },
    "relationships": {
      "items": {
        "data": {
          "type": "items",
          "id": "urn:adsk.wipprod:dm.lineage:recSpZViRvmXWzVU7TKcMw"
        }
      },
      "storage": {
          "data": {
            "type": "objects",
            "id": "urn:adsk.objects:os.object:wip.dm.prod/05138bae-977b-4401-9846- 

958968ca19ec.rvt” } } } }

}

类似地,当您创建一个新项目(第一个版本)时,有效载荷将如下所示:

{
  "jsonapi": {
    "version": "1.0"
  },
  "data": {
    "type": "items",
    "attributes": {
      "displayName": "advanced.rvt",
      "extension": {
        "type": "items:autodesk.bim360:File",
        "version": "1.0"
      }
    },
    "relationships": {
      "tip": {
        "data": {
          "type": "versions",
          "id": "1"
        }
      },
      "parent": {
        "data": {
          "type": "folders",
          "id": "urn:adsk.wipprod:fs.folder:co.oWrOwMCWTpWH-_glicursA"
        }
      }
    }
  },
  "included": [
    {
      "type": "versions",
      "id": "1",
      "attributes": {
        "name": "advanced-mott.rvt",
        "extension": {
          "type": "versions:autodesk.bim360:File",
          "version": "1.0"
        }
      },
      "relationships": {
        "storage": {
          "data": {
            "type": "objects",
            "id": "urn:adsk.objects:os.object:wip.dm.prod/caa01ab2-c1da-4e51-8ae6- 
    892179a12b62.rvt"
          }
        }
      }
    }
  ]
}