Create a Workspace
A workspace is a space where you put all your metrics, visualizations, and dashboards that share underlying data and metadata. It is especially useful if your company has multiple departments, for example Engineering and Sales, and you want to organize analytics for each department individually. You can do it using workspaces and GoodData’s built-in multitenancy.
Open GoodData in a browser, go to Workspaces, and click Create Workspace.
Enter
demo
for the name of the workspace, and click Create.The workspace named
demo
is created and appears in the list of workspaces.
You can create a new workspace using Python code:
from gooddata_sdk import GoodDataSdk, CatalogWorkspace
# GoodData host in the form of uri eg. "https://*.gooddata.com" (GoodData Cloud),
# or "http://localhost:3000" (GoodData Cloud Native)
host = "<GOODDATA_URI>"
# GoodData API token
token = "<API_TOKEN>"
sdk = GoodDataSdk.create(host, token)
# Create a new workspace entity locally
my_workspace_object = CatalogWorkspace("demo", name="demo")
# Create a workspace
sdk.catalog_workspace.create_or_update(my_workspace_object)
You can also get a list of workspaces to confirm that the workspace has been created:
from gooddata_sdk import GoodDataSdk, CatalogWorkspace
# GoodData host in the form of uri eg. "https://*.gooddata.com" (GoodData Cloud),
# or "http://localhost:3000" (GoodData Cloud Native)
host = "<GOODDATA_URI>"
# GoodData API token
token = "<API_TOKEN>"
sdk = GoodDataSdk.create(host, token)
# List workspaces
workspaces = sdk.catalog_workspace.list_workspaces()
print(workspaces)
# [
# CatalogWorkspace(id=demo, name=demo),
# ]
To create a workspace named demo
with the identifier demo
, submit 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": "demo"
},
"id": "demo",
"type": "workspace"
}
}' | jq .
To confirm that the workspace has been created, the server returns the following response:
{
"data": {
"id": "demo",
"type": "workspace",
"attributes": {
"description": "My first workspace created using the API.",
"name": "demo"
}
},
"links": {
"self": "$HOST_URL/api/v1/entities/workspaces/demo"
}
}
To create a workspace named demo
with the identifier of demo
, submit a POST
request to /api/v1/entities/workspaces
:
Invoke-RestMethod -Method Post -Uri '$HOST_URL/api/v1/entities/workspaces' `
-ContentType 'application/vnd.gooddata.api+json' `
-H @{
'Accept' = 'application/vnd.gooddata.api+json'
'Authorization' = 'Bearer <API_TOKEN>'
} `
-Body '{
"data": {
"attributes": {
"description": "My first workspace created using the API.",
"name": "demo"
},
"id": "demo",
"type": "workspace"
}
}' | ConvertTo-Json
To confirm that the workspace has been created, the server returns the following response:
{
"data": {
"id": "demo",
"type": "workspace",
"attributes": {
"description": "My first workspace created using the API.",
"name": "demo"
}
},
"links": {
"self": "$HOST_URL/api/v1/entities/workspaces/demo"
}
}