Search code examples
autodesk-forgeautodeskforge

Autodesk Forge; Pragmatically changing file location without new upload


I would like to change a file directory in Autodesk BIM360 Docs without new upload. Is it possible? How could it be done?

This is an example of what I would like to achieve:

1) Upload file to a temp directory in Autodesk BIM360 Docs

2) Check file content

3) If content OK - move the file to the right directory <- How to do this without a new update?

Thanks


Solution

  • You can use PATCH Items endpoint: /data/v1/projects/:project_id/items/:item_id and the following body:

    {
        "jsonapi": {
            "version": "1.0"
        },
        "data": {
            "type": "items",
            "id": "CURRENT_ITEM_ID",
            "relationships": {
                "parent": {
                    "data": {
                        "type": "folders",
                        "id": "DESTINATION_FOLDER_ID"
                    }
                }
            }
        }
    }