Querying a Workspace List
Function
This API is used to obtain the details of all created workspaces.
This API applies to the following scenario: When you need to view all available workspaces or perform audit, you can use this API to query the workspace list. Before using this API, ensure that you have the view permission. After the query is complete, the system returns all workspace details, including the name, creation time, and status. If you do not have the permission to perform operations, the API will return an error message.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
GET /v1/{project_id}/workspaces
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Definition: Project ID. For details, see Obtaining a Project ID and Name. Constraints: The value can contain 1 to 64 characters. Letters, digits, and hyphens (-) are allowed. Range: N/A Default Value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
offset |
No |
Integer |
Definition: Start page of the pagination list Constraints: N/A Range: The value must no less than 0 and no more than 2147483647. Default Value: 0 |
limit |
No |
Integer |
Definition: Maximum number of records displayed on each page Constraints: N/A Range: The value must no less than 1 and no more than 1000. Default Value: 1000 |
sort_by |
No |
String |
Definition: Sorting field Constraints: N/A Range:
Default Value: name |
order |
No |
String |
Definition: Sorting mode Constraints: N/A Range:
Default Value: desc |
enterprise_project_id |
No |
String |
Definition: Enterprise project ID. If this parameter is specified, only the workspaces of the enterprise project are returned. By default, all workspaces are displayed. Constraints: N/A Range: The value can contain 36 characters. Letters, digits, and hyphens (-) are allowed. Default Value: N/A |
name |
No |
String |
Definition: Workspace name. If this parameter is specified, the fuzzy-match workspaces are queried. By default, all workspaces are displayed. Constraints: N/A Range: The value can contain 1 to 64 characters. Letters, digits, hyphens (-), and underscores (_) are allowed. Default Value: N/A |
filter_accessible |
No |
Boolean |
Definition: Whether accessible workspaces are filtered Constraints: N/A Range:
Default Value: false |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Definition: Requests for calling an API can be authenticated using either a token or AK/SK. If token-based authentication is used, this parameter is mandatory and must be set to a user token. For details, see Obtaining a User Token. Constraints: N/A Range: N/A Default Value: N/A |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
total_count |
Integer |
Definition: Total number of workspaces. Range: N/A |
count |
Integer |
Definition: Number of workspaces returned for the current request. Range: The value must be no less than 0 and no more than the value of limit. |
workspaces |
Array of WorkspaceResponse objects |
Definition: workspace parameters. |
Parameter |
Type |
Description |
---|---|---|
owner |
String |
Definition: Creator name Range: The value can contain 4 to 64 characters. Letters, digits, hyphens (-), and underscores (_) are allowed. |
auth_type |
String |
Definition: Authorization type Range:
|
enterprise_project_id |
String |
Definition: Enterprise project ID Range: ID of an enabled enterprise project. The value contains 36 characters. Letters, digits, and hyphens (-) are allowed. |
update_time |
Integer |
Definition: Last modification time, in UTC format Range: N/A |
create_time |
Integer |
Definition: Creation time, in UTC format Range: N/A |
enterprise_project_name |
String |
Definition: Enterprise project name Range: Name of the enterprise project corresponding to the response parameter enterprise_project_id |
name |
String |
Definition: Workspace name Range: The value can contain 4 to 64 characters. Letters, digits, hyphens (-), and underscores (_) are allowed. |
description |
String |
Definition: Workspace description Range: The value can contain 0 to 256 characters. It cannot contain the following special characters: < > = & " ' / |
id |
String |
Definition: Workspace ID. For details about how to obtain the ID, see Querying the Workspace List. Range: It is a 32-bit UUID without hyphens (-). The ID of the default workspace is 0. |
status |
String |
Definition: Workspace status Range:
|
status_info |
String |
Definition: Status description. By default, this parameter is left blank. This parameter is used to show detailed information about a status. If a deletion failed, you can use this parameter to obtain the failure cause. Range: N/A |
Example Requests
Filtering the records whose enterprise project ID is 0, sorting the records by name in descending order, and obtaining a record on the fourth page in pagination mode
GET https://{endpoint}/v1/{project_id}/workspaces?limit=1&offset=3&sort_by=name&order=desc&enterprise_project_id=0
Example Responses
Status code: 200
Response parameter indicating that workspaces are obtained
{ "total_count" : 1, "count" : 1, "workspaces" : [ { "id" : 0, "name" : "default", "description" : "", "owner" : "testUser", "enterprise_project_id" : "***b0091-887f-4839-9929-cbc884f1e***", "enterprise_project_name" : "default", "auth_type" : "public", "create_time" : 1460000010000, "update_time" : 1460000010000, "status" : "NORMAL", "status_info" : "" } ] }
Status Codes
Status Code |
Description |
---|---|
200 |
Response parameter indicating that workspaces are obtained |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot