Creating a Workspace
Function
This API is used to create a workspace.
URI
POST /v1/{project_id}/workspaces
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Body
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Workspace name, encoded using UTF-8. The value is a string of 4 to 64 characters consisting of Chinese characters, uppercase and lowercase letters, digits, hyphens (-), and underscores (_). In addition, default is the default workspace name reserved by the system. You cannot create a workspace named default. |
|
description |
No |
String |
Workspace description. By default, this parameter is left blank. The value is a string of 0 to 256 characters. |
|
enterprise_project_id |
No |
String |
Enterprise project ID
NOTE:
For details about how to obtain enterprise project IDs and features, see the Enterprise Management Service User Guide. If this parameter is not specified or is set to 0, resources will be bound to the default enterprise project. |
|
auth_type |
No |
String |
Authorization type. Possible values are PUBLIC, PRIVATE, and INTERNAL. Default value: PUBLIC
|
|
grants |
No |
grant array |
List of authorized users. By default, this parameter is left blank. This parameter must be used together with auth_type and takes effect only when auth_type is set to INTERNAL. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
user_id |
No |
String |
IAM user ID. Configure either this parameter or user_name. If both of them are available, user_id is preferred. |
|
user_name |
No |
String |
IAM username. Configure either this parameter or user_id. |
Response Body
Table 2 describes the response parameters.
|
Parameter |
Type |
Description |
|---|---|---|
|
error_msg |
String |
Error message of a failed API call. This parameter is not included when the API call succeeds. |
|
error_code |
String |
Error code of a failed API call. For details, see Error Code. This parameter is not included when the API call succeeds. |
|
request_id |
String |
request_id information of a failed API call. This parameter is not included when the API call succeeds. |
|
id |
String |
Workspace ID, which is a 32-bit UUID generated by the system without hyphens (-) |
|
name |
String |
Workspace name |
|
description |
String |
Workspace description |
|
owner |
String |
Name of the user who creates a workspace |
|
create_time |
Long |
Time when a workspace is created, in UTC format |
|
update_time |
Long |
Last modification time, in UTC format |
|
enterprise_project_id |
String |
Enterprise project ID |
|
enterprise_project_name |
String |
Name of an enterprise project |
|
auth_type |
String |
Authorization type. Default value: PUBLIC
|
|
status |
String |
Workspace status. Possible values are as follows:
|
|
grants |
grant array |
List of authorized users |
|
Parameter |
Type |
Description |
|---|---|---|
|
user_id |
String |
IAM user ID |
|
user_name |
String |
IAM username |
Samples
- Sample request
POST https://{endpoint}/v1/{project_id}/workspaces { "name": "test-workspace", "description": "It's a test project", "enterprise_project_id": "10eb0091-887f-4839-9929-cbc884f1e20e", "auth_type": "internal", "grants": [ { "user_name": "test" } ] }
- Successful sample response
{ "id": "cfedf4a550124446a0c781c2deababe0", "name": "test-workspace", "description": "It's a test project", "owner": "testUser", "create_time": 1470000020000, "update_time": 1470000020000, "enterprise_project_id":"10eb0091-887f-4839-9929-cbc884f1e20e", "enterprise_project_name": "test-eps", "auth_type": "public", "status": "NORMAL" } - Failed sample response
{ "error_msg": "Error message.", "error_code": "ModelArts.0104", "request_id": "21b81005261c4da5a627b4e9b9d58d50" }
Status Code
For details about the status code, see Table 1.
Last Article: Workspace Management
Next Article: Querying the List of Workspaces
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.