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:

  1. Create a GET request to the following endpoint:

    https://{{INSTANCE}}/api/stacks/
    
  2. 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.

  3. 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 available storages

To list available storages, follow these steps:

  1. Create a GET request to the following endpoint:

    https://{{INSTANCE}}/api/storage/
    
  2. In the HTTP request header, include the parameter Authorization with value Token {{KEY}}.

  3. 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:

  1. Create a POST request to the following endpoint:

    https://{{INSTANCE}}/api/stacks/
    
  2. In the HTTP request header, include the parameter Authorization with value Token {{KEY}}.

  3. In the HTTP request header, include the parameter Content-Type with value application/json.

  4. 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 parameter id 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.

  5. 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"}'