Querying the List of Workspaces
Function
This API is used to query the list of workspaces with certain permissions. The list contains detailed information about the workspaces.
URI
GET /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
Table 2 describes the request parameters.
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
offset |
No |
Integer |
Start page of the paging list. Default value: 0 |
|
limit |
No |
Integer |
Maximum number of records returned on each page. Default value: 1000 |
|
sort_by |
No |
String |
Sorting mode. The value can be name, update_time, or status. Default value: name |
|
order |
No |
String |
Sorting order. Possible values are as follows:
|
|
enterprise_project_id |
No |
String |
Enterprise project ID. If this parameter is specified, only the workspaces of the enterprise project are returned. By default, all workspaces are queried. |
|
name |
No |
String |
Workspace name. If this parameter is specified, the fuzzy-match workspaces are queried. By default, all workspaces are queried. |
|
filter_accessible |
No |
Boolean |
This parameter is used to filter accessible workspaces. If this parameter is set to true, the workspaces that a user does not have permission to access are filtered out. The default value is false, indicating that all workspaces are displayed. |
Response Body
|
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. |
|
total_count |
Integer |
Total number of workspaces |
|
count |
Integer |
Number of workspaces returned by the request |
|
workspaces |
workspaces array |
Workspace details. For details, see Table 4. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Workspace ID, which is a 32-bit UUID generated by the system without hyphens (-). The ID of the default workspace is 0. |
|
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:
|
Samples
- Sample request
GET https://{endpoint}/v1/{project_id}/workspaces?limit=2&offset=3&sort_by=name&order=desc&enterprise_project_id=0
- Successful sample response
{ "total_count": 10, "count": 2, "workspaces": [ { "id": "0", "name": "default", "description": "", "owner": "testUser", "enterprise_project_id":"10eb0091-887f-4839-9929-cbc884f1e20e", "enterprise_project_name": "default", "auth_type": "public", "create_time": 1460000010000, "update_time": 1460000010000, "status": "NORMAL" }, { "id": "02862d4c505a47288dc1ae50a2aabca9", "name": "test-workspace", "description": "It's a test workspace", "owner": "testUser", "enterprise_project_id":"10eb0091-887f-4839-9929-cbc884f1e20e", "enterprise_project_name": "test-eps", "auth_type": "public", "create_time": 1470000020000, "update_time": 1470000020000, "status": "NORMAL" } ] } - Failed sample response
{ "error_msg": "Error message.", "error_code": "ModelArts.0104", "request_id": "5ecaca8b423ab595a2f5d789d31a1fc5" }
Status Code
For details about the status code, see Table 1.
Last Article: Creating a Workspace
Next Article: Deleting a Workspace
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.