Help Center> RES> API Reference> API> Workspace> Creating a Workspace

Creating a Workspace

Function

This API is used to create an independent workspace in RES for resource isolation. You can create data sources, scenarios, and recommendation tasks in the workspace. Whether a user has the operation permissions on workspaces depends on whether the user belongs to the enterprise project bound to the current workspace.

URI

POST /v2.0/{project_id}/workspaces

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details on how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Content type. The value is application/json.

X-Auth-Token

Yes

String

User token. For details on how to obtain the user token, see Obtaining a User Token Through Password Authentication.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Workspace name, which is a string of 1 to 64 characters and contains digits, letters, underscores (_), and hyphens (-). It cannot end with a hyphen (-).

Minimum: 1

Maximum: 64

enterprise_project_id

Yes

String

Enterprise project ID

Minimum: 1

Maximum: 256

description

No

String

Description

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

is_success

Boolean

Whether the request is successful

message

String

Response message

error_code

String

Error code (This parameter is not returned when the request is successful.)

Example Requests

This API is used to create a workspace.

/v2.0/testuuidxxxxxxxxxxxxxxxxxxxxxxxx/workspaces

{
  "description" : "",
  "enterprise_project_id" : "0",
  "name" : "workspace1"
}

Example Responses

Status code: 200

OK

{
  "is_success" : true,
  "message" : "Succeed to create workspace."
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.