Sharing Functions
You can use the Studio Data SDK to configure resource permissions, allowing you to share assets with other individuals and your organization.
Note: Experimental features!
One or more of the functions below reference "editor" permissions for your assets. This relates to an experimental collaboration feature that you or your organization might not have access to.
Sounds interesting? Reach out in the Studio Community Slack channel!
Get Permissions
Get permissions for a resource stored in your Studio workspace.
Permissions include "viewer"
and "editor"
, and can be modified for individuals (via emails) or your entire organization via the set-permissions
functions.
data_sdk.get_permissions(
resource_type = "<resource_type>",
resource_id = "<UUID>"
)
fsq-data-sdk get-permissions
--resource-type "<resource_type>"
--resource-id "<UUID>"
curl GET 'https://data-api.foursquare.com/v1/permissions/<resource_type>/<resource_uuid>' --header 'Authorization: Bearer <token>'
Arguments
Argument | Type | Description |
---|---|---|
resource_type | string | The type of resource to get permissions for. Can be one of "map" , "dataset" , or "data-connector" . |
resource_id | string | The UUID for the resource. These can be retrieved from the list_maps , list_datasets , or list_data_connectors functions. |
Learn more in the SDK reference
Set Permissions
Set permissions for a resource stored in your Studio workspace, allowing you to share your assets with others.
Permissions include "viewer"
and "editor"
, and can be modified for individuals (via emails) or your entire organization. To remove permissions, simply omit them from set_permissions
. In other words:
- If the permission didn't exist for a specific org/user before - it is created.
- If the permissions existed but changed level - it is updated.
- If the permission existed, but is now omitted - it is removed.
data_sdk.set_permissions(
resource_type = "<resource_type>",
resource_id = "<UUID>"
permissions = {
"organization": "viewer",
"users": [
{
"email": "[email protected]",
"permission": "editor"
},
{
"email": "[email protected]",
"permission": "viewer
}
]
}
)
fsq-data-sdk set-permissions
--resource-type "<resource_type>"
--resource-id "[UUID]"
--editor [email protected]
--editor [email protected]
--viewer [email protected]
--viewer [email protected]
--editor [email protected]
curl --location POST 'https://data-api.foursquare.com/v1/permissions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"resourceType": "<resource_type>",
"resourceId": "<UUID>",
"permissions": {
"users": [
{
"email": "[email protected]",
"permission": "editor"
}, {
"email": "[email protected]",
"permission": "view"
}
]
}
}'
Arguments
Argument | Type | Description |
---|---|---|
resource_type | string | The type of resource to get permissions for. Can be one of "map" or "dataset . |
resource_id | string | The UUID for the resource. These can be retrieved from the list_map or list_datasets functions. |
Learn more in the SDK reference
Updated 4 months ago