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.
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.
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 |
|---|---|---|---|
|
string |
Yes |
The name of the workspace to be created. It cannot be empty after removing leading and trailing blanks. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"id": "ws_01"
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
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.
{
"code": "ErrWorkspaceAlreadyExists",
"msg": "工作区已存在",
"data": null
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
Readable error message. |
|
null |
The error response is |