【问题标题】:Autodesk BIM360: Folder Creation returns 400 Bad requestAutodesk BIM360:文件夹创建返回 400 错误请求
【发布时间】:2017-08-10 18:31:23
【问题描述】:

我根据this example 使用带有 JSON 正文的 Postman 调用了 POST-Folder 方法。但我只收到“400 Bad Request”消息,没有任何解释。这是我的请求的样子:

服务地址:

https://developer.api.autodesk.com/data/v1/projects/b.5823d0b2-0000-0000-00/commands

HTTP 标头

Authorization: Bearer 2_legged_token
Content-Type:  application/vnd.api+json

JSON 主体

{
   "jsonapi": {
      "version": "1.0"
   },
   "data": {
      "type": "commands",
      "attributes": {
         "extension": {
            "type": "commands:autodesk.core:CreateFolder",
            "version": "1.0.0",
            "data": {
               "requiredAction": "create"
            }
         }
      },
      "relationships": {
         "resources": {
            "data": [
               {
                  "type": "folders",
                  "id": "1"
               }
            ]
         }
      }
   },
   "included": [
      {
         "type": "folders",
         "id": "1",
         "attributes": {
            "name": "test",
            "extension": {
               "type": "folders:autodesk.bim360:Folder",
               "version": "1.0.0"
            }
         },
         "relationships": {
            "parent": {
               "data": {
                  "type": "folders",
                  "id": "urn:adsk.wipprod:fs.folder:co.Ai*****"
               }
            }
         }
      }
   ]
}

回应

{
    "jsonapi": {
        "version": "1.0"
    },
    "errors": [
        {
            "id": "f1266e76-a37e-400b-bff6-de84b11cdb00",
            "status": "400",
            "detail": "BadRequest"
        }
    ]
}

到目前为止我发现了什么:

  • 项目ID是正确的。当我使用错误的项目 ID 时,我会收到另一个错误。
  • Json 也是有效的。
  • 当我使用(肯定)错误的父文件夹时,我会收到相同的错误消息。所以也许这是一个错误的骨灰盒格式或什么?

【问题讨论】:

    标签: autodesk-data-management


    【解决方案1】:

    正如您所指出的,到目前为止,您可以使用命令端点创建 BIM 360 Docs 文件夹。为此,您可以使用:

    • 3-legged令牌
    • 带有x-user-id 标头的2-legged 令牌,这应包含从GET users@me 端点获取的Autodesk 用户ID
    • “纯”2-legged 令牌将返回错误请求(截至 2017 年 8 月)

    对文档感到抱歉,通过命令创建 BIM 360 Docs 文件夹的端点已在几周前发布,我们刚刚完成编写文档。

    【讨论】:

    • 谢谢。现在它正在工作。我想只有创建它的用户才能看到该文件夹​​?还是项目中的每个人都会看到它?
    • 文件和文件夹是项目明智的,除非您指定不同/特定的访问权限。
    • 非常感谢
    猜你喜欢
    • 2018-01-17
    • 2016-12-04
    • 2018-05-10
    • 2016-04-21
    • 1970-01-01
    • 2019-07-28
    • 2019-07-11
    • 2015-04-06
    • 1970-01-01
    相关资源
    最近更新 更多