jash
jash

Reputation: 41

Rename items in BIM 360 using autodesk forge

We are upgrading our revit projects from 2020 to 2022 and our revit file names end with the version they belong to for easy identification ( xxxx_R20.rvt) and we'd like to rename all the items in the project to xxxx_R22.rvt. I have been able to gather all the items, their names and their URNs for a patch... but the patch item throws an error saying :

{
    "jsonapi": {
        "version": "1.0"
    },
    "errors": [
        {
            "id": "5f1b5519-3118-4c43-80f4-97c412419acf",
            "status": "403",
            "code": "USER_NOT_AUTHENTICATED",
            "detail": "The client_id is not whitelisted for schema 'items:autodesk.bim360:C4RModel' access."
        }
    ]
}

The forge client id does have access to the account and has been used to make many other changes... I did try using the patch from versions to make the change to the name with no luck ... ( I receive the same error)

Upvotes: 3

Views: 471

Answers (2)

rchen
rchen

Reputation: 19

I tried Zhong Wu's answer and it works for C4RModels (I would post a comment, but I don't have enough reputation). These are the steps I took:

Upvotes: 0

Zhong Wu
Zhong Wu

Reputation: 2024

You can not rename the file by PATCH item API, actually, you need to create a new version with the new file name, but you don't have to upload file again. Please try the following api:

POST /versions?copyFrom={tip_version_urn}

{
    "jsonapi": {
        "version": "1.0"
    },
    "data": {
        "type": "versions",
        "attributes": {
            "name": "newName"
        }
    }
}

A new tip version will be created and its properties - including source file - depends on the copyFrom version you provide, usually it is the tip version.

Upvotes: 2

Related Questions