Create Workspace
In GoodData, every project needs at least one workspace. A workspace is an environment where you create and store all of your analytics.
You can use features like workspace hierarchies and data filters for larger projects that need multiple workspaces. To start, check out Set Up Multiple Tenants.
- On the home page, switch to Workspaces.
- Click the Create workspace button
- Name your workspace and click Create.
- Your workspace will now appear on the Workspaces page. Open it to connect to your data source, create a logical data model, and build analytics.
To create a workspace using Python, use this code:
from gooddata_sdk import GoodDataSdk, CatalogWorkspace
host = "<GOODDATA_URI>"
token = "<API_TOKEN>"
sdk = GoodDataSdk.create(host, token)
# Create a new workspace entity locally
my_workspace_object = CatalogWorkspace("some_workspace_id", name="Workspace Name")
# Create a workspace
sdk.catalog_workspace.create_or_update(my_workspace_object)
To confirm the workspace was created, list all workspaces:
from gooddata_sdk import GoodDataSdk, CatalogWorkspace
host = "<GOODDATA_URI>"
token = "<API_TOKEN>"
sdk = GoodDataSdk.create(host, token)
# List workspaces
workspaces = sdk.catalog_workspace.list_workspaces()
print(workspaces)
# [
# CatalogWorkspace(id=some_workspace_id, name='Workspace Name'),
# ]
To create a workspace named Workspace Name
with the ID some_workspace_id
, send a POST
request to /api/v1/entities/workspaces
:
curl $HOST_URL/api/v1/entities/workspaces \
-H "Content-Type: application/vnd.gooddata.api+json" \
-H "Accept: application/vnd.gooddata.api+json" \
-H "Authorization: Bearer <API_TOKEN>" \
-X POST \
-d '{
"data": {
"attributes": {
"description": "My first workspace created using the API.",
"name": "Workspace Name"
},
"id": "some_workspace_id",
"type": "workspace"
}
}' | jq .
After the workspace is created, the server will return this response:
{
"data": {
"id": "some_workspace_id",
"type": "workspace",
"attributes": {
"description": "My first workspace created using the API.",
"name": "Workspace Name"
}
},
"links": {
"self": "$HOST_URL/api/v1/entities/workspaces/some_workspace_id"
}
}
Workspace API
The web UI lets you perform basic workspace tasks like creating or deleting workspaces. You need to use the API or Python SDK for more advanced actions, such as cloning, creating backups, or managing content.
There are two main types of interfaces for managing workspaces:
- The Metadata Entity Interface lets you manage individual objects or retrieve them in batches.
- The Workspace Declarative Interface manages everything as a single model in one document.