Create a workspace

Create a workspace and wait for initialization to complete, returning the new workspace ID.

The console uses Submit the workspace creation task to create the workspace asynchronously.

HTTP
POST $CLOUDSIGMA_API_BASE/workspaces

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First determine the name of the new workspace. Prepare personal access token.

Request body

Replace $CLOUDSIGMA_API_KEY and $WORKSPACE_NAME with actual values.

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/workspaces" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "'"$WORKSPACE_NAME"'"
  }'

Parameter

Type

Required

Description

name

string

Yes

The name of the workspace to be created. It cannot be empty after removing leading and trailing blanks.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "id": "ws_01"
  }
}

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data.id

string

New workspace ID.

Error response

After the workspace is created, initialization may still fail. Before trying again, Query the workspace list to confirm whether it has been created.

JSON
{
  "code": "ErrWorkspaceAlreadyExists",
  "msg": "工作区已存在",
  "data": null
}

Field

Type

Description

code

string

error code.

msg

string

Readable error message.

data

null

The error response is null.

Last updated on