Help Center> ModelArts> API Reference> Workspace Management> Querying the List of Workspaces

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

Table 1 describes the required parameters.
Table 1 Parameter description

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.

Table 2 Parameter description

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:

  • asc: ascending order
  • desc: descending order. The default value is desc.

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

Table 3 describes the response parameters.
Table 3 Parameter description

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.

Table 4 workspaces parameters

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

  • PUBLIC: public access of tenants
  • PRIVATE: accessible only to the creator and primary account
  • INTERNAL: accessible to the creator, main account, and specified IAM users. This parameter must be used together with grants.

status

String

Workspace status. Possible values are as follows:

  • CREATE_FAILED: The workspace failed to be created.
  • NORMAL: The workspace is normal.
  • DELETING: The workspace is being deleted.
  • DELETE_FAILED: The workspace failed to be deleted.

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.