Creating workspaces in Management API
This article explains how to create and list workspaces with the Management API.
Listing existing workspaces
To list existing workspaces, follow these steps:
-
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/stacks/
-
In the HTTP request header, include the parameter
Authorization
with one of the following values:-
Token {{KEY}}
if you use a key generated with user credentials in Management API. -
Bearer {{KEY}}
if you use a key generated in the Adverity user interface.
-
-
Send the request.
As a result, you obtain the list of available workspaces in Management API and their IDs in the response.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location --request GET 'https://{{INSTANCE}}/api/stacks/' \
--header 'Authorization: Token {{KEY}}'
Listing workspaces with Bearer API key
To list existing workspaces using Bearer API key, follow these steps:
-
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/v1/workspaces/
-
In the HTTP request header, include the parameter
Authorization
with valueBearer {{KEY}}
. -
Send the request.
As a result, you obtain the list of available workspaces in Management API and their IDs in the response.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location --request GET 'https://{{INSTANCE}}/api/v1/workspaces/' \
--header 'Authorization: Bearer {{KEY}}'
Listing available storages
To list available storages, follow these steps:
-
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/storage/
-
In the HTTP request header, include the parameter
Authorization
with valueToken {{KEY}}
. -
Send the request.
As a result, you obtain the list of available storage options.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location --request GET 'https://{{INSTANCE}}/api/storage/' \
--header 'Authorization: Token {{KEY}}'
Creating a new workspace
To create a new workspace (called Stack in Management API), follow these steps:
-
Create a POST request to the following endpoint:
https://{{INSTANCE}}/api/stacks/
-
In the HTTP request header, include the parameter
Authorization
with valueToken {{KEY}}
. -
In the HTTP request header, include the parameter
Content-Type
with valueapplication/json
. -
In the HTTP request body, include the following code as raw JSON input, and then replace the red values as necessary.
{"datalake_id": STORAGE_ID, "name":"NAME_OF_NEW_WORKSPACE"}
Replace the following:
-
STORAGE_ID
: Include the value of the parameterid
in the API response where you list available storages. To obtain the described list, follow the procedure in Listing available storages. -
NAME_OF_NEW_WORKSPACE
: Choose any name for your new workspace which does not currently exist.
-
-
Send the request.
As a result, you created a new workspace through the Management API.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location --request POST 'https://{{INSTANCE}}/api/stacks/' \
--header 'Authorization: Token {{KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{"datalake_id": STORAGE_ID, "name":"NAME_OF_NEW_WORKSPACE"}'