获取BIM 360 Docs项目和计划文件夹

时间:2018-12-30 10:07:26

标签: rest autodesk-forge

听起来像一个简单的问题吧?

我想要BIM360 Docs的2个ROOT文件夹的ID。 计划和项目文件夹。

2个问题....:(

第一个是ROOT文件夹可以在BIM360 Docs中重命名,因此我可以按名称或字符串值查找。 (对于重命名的ROOT Folder,它在NAME和DISPLAYNAME中已重命名)

第二个是,如果您使用Data Management API中的GetTopLevel文件夹,它也会为我提供所有隐藏的文件夹。

因此,自动响应是说为什么不使用文件夹的属性并忽略隐藏的文件夹。......低而看到的所有文件夹的属性都设置为HIDDEN = False。尽管显然有些文件夹没有出现在BIM360 Docs中,但是必须以另一种方式隐藏。

All Hidden Folders

有人有任何建议吗?

预先感谢。 新年快乐。

1 个答案:

答案 0 :(得分:0)

如果您使用top folders API(“三足”令牌)调用OAuth 2.0 Authorization Code Grant access token,则应该只获得“计划”和“项目文件”文件夹

请求:

curl -X GET -H "Authorization: Bearer YOUR_JWT_TOKEN" 
"https://developer.api.autodesk.com/project/v1/hubs/b.hub.id.123/projects/b.project.id.xyz/topFolders"

响应:

{
"jsonapi": {
    "version": "1.0"
},
"links": {
    "self": {
        "href": "https://developer.api.autodesk.com/project/v1/hubs/b.hub.id.123/projects/b.project.id.xyz/topFolders"
    }
},
"data": [
    {
        "type": "folders",
        "id": "urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg",
        "attributes": {
            "name": "Plans",
            "displayName": "Plans",
            "createTime": "2017-06-26T09:27:39.0000000Z",
            "createUserId": "",
            "createUserName": "",
            "lastModifiedTime": "2017-06-26T09:27:39.0000000Z",
            "lastModifiedUserId": "",
            "lastModifiedUserName": "",
            "lastModifiedTimeRollup": "2017-06-26T09:27:39.0000000Z",
            "objectCount": 0,
            "hidden": false,
            "extension": {
                "type": "folders:autodesk.bim360:Folder",
                "version": "1.0",
                "schema": {
                    "href": "https://developer.api.autodesk.com/schema/v1/versions/folders:autodesk.bim360:Folder-1.0"
                },
                "data": {
                    "visibleTypes": [
                        "items:autodesk.bim360:Document"
                    ],
                    "actions": [
                        "CONVERT",
                        "SPLIT",
                        "OCR"
                    ],
                    "allowedTypes": [
                        "folders:autodesk.bim360:Folder",
                        "items:autodesk.bim360:File",
                        "items:autodesk.bim360:Document",
                        "items:autodesk.bim360:TitleBlock",
                        "items:autodesk.bim360:ReviewDocument"
                    ]
                }
            }
        },
        "links": {
            "self": {
                "href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg"
            }
        },
        "relationships": {
            "contents": {
                "links": {
                    "related": {
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg/contents"
                    }
                }
            },
            "parent": {
                "data": {
                    "type": "folders",
                    "id": "urn:adsk.wipprod:fs.folder:co.8w-SI-ggRAuTQcTlD0GK6g"
                },
                "links": {
                    "related": {
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg/parent"
                    }
                }
            },
            "refs": {
                "links": {
                    "self": {
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg/relationships/refs"
                    },
                    "related": {
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg/refs"
                    }
                }
            },
            "links": {
                "links": {
                    "self": {
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg/relationships/links"
                    }
                }
            }
        }
    },
    {
        "type": "folders",
        "id": "urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w",
        "attributes": {
            "name": "Project Files",
            "displayName": "Project Files",
            "createTime": "2017-06-26T09:27:41.0000000Z",
            "createUserId": "",
            "createUserName": "",
            "lastModifiedTime": "2017-11-08T13:06:58.0000000Z",
            "lastModifiedUserId": "XXXXXXXX",
            "lastModifiedUserName": "John%20Smith",
            "lastModifiedTimeRollup": "2018-01-10T09:09:36.0000000Z",
            "objectCount": 6,
            "hidden": false,
            "extension": {
                "type": "folders:autodesk.bim360:Folder",
                "version": "1.0",
                "schema": {
                    "href": "https://developer.api.autodesk.com/schema/v1/versions/folders:autodesk.bim360:Folder-1.0"
                },
                "data": {
                    "visibleTypes": [
                        "items:autodesk.bim360:File"
                    ],
                    "actions": [
                        "CONVERT"
                    ],
                    "allowedTypes": [
                        "items:autodesk.bim360:File",
                        "folders:autodesk.bim360:Folder"
                    ]
                }
            }
        },
        "links": {
            "self": {
                "href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w"
            }
        },
        "relationships": {
            "contents": {
                "links": {
                    "related": {
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w/contents"
                    }
                }
            },
            "parent": {
                "data": {
                    "type": "folders",
                    "id": "urn:adsk.wipprod:fs.folder:co.8w-SI-ggRAuTQcTlD0GK6g"
                },
                "links": {
                    "related": {
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w/parent"
                    }
                }
            },
            "refs": {
                "links": {
                    "self": {
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w/relationships/refs"
                    },
                    "related": {
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w/refs"
                    }
                }
            },
            "links": {
                "links": {
                    "self": {
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w/relationships/links"
                    }
                }
            }
        }
    }
]

}