Hey. Is there a way to change a workspaces ID via ...
# gooddata-cloud
Hey. Is there a way to change a workspaces ID via API? And if yes, will it break anything (like permissions)? I tried running
PATCH {{baseUrl}}/api/v1/entities/workspaces/
but that doesn't work
Hi Filip, no, you cannot change a workspaces ID. Workspace IDs are immutable and cannot be modified after they are created. This is to ensure the integrity of the GoodData Cloud data model and to prevent potential conflicts or errors
I would like to add, you can set a unique custom prefix for each workspace. When you create a new analytical object (metric, visualization, dashboard) in that workspace, the prefix is automatically prepended to its object ID. You can find more details here: https://www.gooddata.com/docs/cloud/create-workspaces/objects-identification/#WorkspaceObjectIdentification-CustomObjectIDPrefix
If I am not mistaken, the declarative (layout) API on organization level should allow you to get everything (all workspaces, permissions etc.) in your environment in a form of single JSON, you can modify the identifier (everywhere where it is used) and post this updated definition back (plus add passwords if needed). But for sure this approach would be better tested on some non-production environment first. (Also note you might need some passwords as those are not exported). Or alternatively you can get the layout and use pieces of it (wprkspave definition, permissions, custom objects) to create new workspace with new ID using several individual single-workspace API calls.
🙌 1
Or even better, you can use our Python SDK for that. I implemented a dedicated function for it - clone_workspace() Because you clone it to a new ID, it is safe, the old workspace stays untouched. If you would hit any issue with this cloning, let me know, I can fix it quickly...