Create a Workspace
A workspace helps you organize analytics. You can think of workspace as space where you put all your metrics, visualizations, and dashboards that share underlying data and metadata. Let’s say that your company has two departments, engineering and sales, and you want to organize analytics for each department individually. You can do it simply with workspaces and built-it multitenancy (we will cover the topic later but feel free to check it right now - distribute analytics to users).
Open GoodData on the
Workspaces
page in the browser, and click Create Workspace.Enter
demo
for the name of the workspace, and click Create.The workspace called
demo
is created and appears in the list of workspaces.
You can create a new workspace with few lines of 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 new workspace entity locally
my_workspace_object = CatalogWorkspace("demo", name="demo")
# Create workspace
sdk.catalog_workspace.create_or_update(my_workspace_object)
You can also get 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 called demo
with the identifier of demo
, submit a POST
request to /api/v1/entities/workspaces
:
curl $ENDPOINT/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": {
"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": {
"name": "demo"
}
},
"links": {
"self": "$ENDPOINT/api/v1/entities/workspaces/demo"
}
}
To create a workspace called demo
with the identifier of demo
, submit a POST
request to /api/v1/entities/workspaces
:
Invoke-RestMethod -Method Post -Uri '$ENDPOINT/api/v1/entities/workspaces' `
-ContentType 'application/vnd.gooddata.api+json' `
-H @{
'Accept' = 'application/vnd.gooddata.api+json'
'Authorization' = 'Bearer <API_TOKEN>'
} `
-Body '{
"data": {
"attributes": {
"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": {
"name": "demo"
}
},
"links": {
"self": "$ENDPOINT/api/v1/entities/workspaces/demo"
}
}