palantir-foundrypalantir-foundry-api

Is there an endpoint to add permissions to a compass folder?


I need to update folder permissions with the Foundry API, but all of the endpoints found in Google search return a 404 error. Each of these came up in the AI Overview, but none seem to be in official Palantir API docs. Does anyone have a link to official documentation to do this, or know the current endpoint?

https://{HOSTNAME}/api/v2/folders/{folder_id}/permissions
https://{HOSTNAME}/api/v1/projects/{project_id}/folders/{folder_id}/permissions
https://{HOSTNAME}/api/v2/projects/{project_id}/folders/{folder_id}/permissions
https://{HOSTNAME}/api/v2/resources/{folder_id}/permissions

Example from search: enter image description here


Solution

  • I found one that works in our stack. It can also add User permissions to a compass folder but the example below is for Groups. I had to use DevTools to find this, which I don't really feel great about due to the reasons ZettaP mentioned.

    If anyone from Palantir is reading this far I'd still like to know if there is an 'official' endpoint - adding a group to a folder doesn't seem too edge for this API.

    path = f"compass/api/roles/v2/{FOLDER_RID}"
    
    # POST REQUEST
    payload = {
                "disableInheritedPermissionsForPrincipals" : [],
                "grantPatches": [{
                    "patchOperation" : "ADD",
                    "roleGrant" : {
                        "principal" : {
                            "id" : {GROUP RID},
                            "type" : "GROUP"
                        },
                        "role" : "{ROLE RID}"  # Also had to use DevTools to find each of these role RIDs by manually adding a group to a folder and watching the Network tab
                    }
                }],
            }