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.
Code Examples
Python
data_sdk.get_permissions(
resource_type = "<resource_type>",
resource_id = "<UUID>"
)
CLI
fsq-data-sdk get-permissions
--resource-type "<resource_type>"
--resource-id "<UUID>"
HTTP
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. |
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.
Code Examples
Python
data_sdk.set_permissions(
resource_type = "<resource_type>",
resource_id = "<UUID>",
permissions = {
"organization": "viewer",
"users": [
{
"email": "one@mail.com",
"permission": "editor"
},
{
"email": "three@mail.com",
"permission": "viewer"
}
]
}
)
CLI
fsq-data-sdk set-permissions
--resource-type "<resource_type>"
--resource-id "[UUID]"
--editor one@mail.com
--editor two@mail.com
--viewer three@mail.com
--viewer four@mail.com
--editor five@mail.com
HTTP
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": "user1@mail.com",
"permission": "editor"
}, {
"email": "user2@mail.com",
"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. |