# Querying a Workspace List

#### Function

This API is used to obtain a workspace list with detailed information contained in the response body.

#### URI

GET /v1/{project_id}/workspaces

Table 1 Path parameters
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
project_id | Yes | String | Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Table 2 Query parameters
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
offset | No | Integer | Start page for pagination display. The default value is 0. Minimum: 0 Default: 0
limit | No | Integer | Maximum number of records returned on each page. Default value: 1000 Minimum: 1 Default: 1000
sort_by | No | String | Sorting mode. The value can be name, update_time, or status. Default value: name Default: name

order

No

String

Query sequence. Options:

- asc: ascending order

- desc: descending order (default value)

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 displayed.
name | No | String | Workspace name. If this parameter is specified, the fuzzy-match workspaces are obtained. By default, all workspaces are displayed.
filter_accessible | No | Boolean | Filter accessible workspaces. If this parameter is set to true, the workspaces you are not allowed to access are filtered out. The default value is false, indicating all workspaces are displayed. Default: false

#### Request Parameters

None

#### Response Parameters

Status code: 200

Table 3 Response body parameters
Parameter | Type | Description
--- | --- | ---
total_count | Integer | Total number of workspace queries
count | Integer | Number of workspaces returned for the current request
workspaces | Array of workspacePropertiesWithoutGrants objects | Workspace details

Table 4 workspacePropertiesWithoutGrants
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. Enter 0 to 256 characters.
owner | String | Creator name. Enter 0 to 64 characters.
create_time | Number | Time when a workspace was created, in UTC format
update_time | Number | Last modification time, in UTC format

auth_type

String

Authorization type. Options:

- PUBLIC: public access of tenants (default value)

- PRIVATE: accessible only to the creator and primary account

- INTERNAL: accessible to the creator, primary account, and specified IAM users. This parameter must be used together with grants.

enterprise_project_id | String | Enterprise project ID
enterprise_project_name | String | Name of an enterprise project

status

String

Workspace status. Options:

- CREATE_FAILED: Creating the workspace failed.

- NORMAL: The workspace is running properly.

- DELETING: The workspace is being deleted.

- DELETE_FAILED: Deleting the workspace failed.

status_info | String | 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.

#### Example Requests

Querying a Workspace List

    GET https://{endpoint}/v1/{project_id}/workspaces?limit=2&offset=3&sort_by=name&order=desc&enterprise_project_id=0

#### Example Responses

Status code: 200

OK

    {
      "total_count" : 10,
      "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 | OK
400 | BadRequest
403 | Forbidden
500 | InternalServerError

#### Error Codes

See Error Codes.

Parent topic: Workspace Management