Query Resources in Space

Last Updated on : 2024-06-28 23:28:22download

Query a list of resources in the specified space. If only_sub is specified as false, you can query the list of resources under the current space and all subspaces. Otherwise, you query only the list of resources under the current space.

API address

GET: /v2.0/cloud/space/{space_id}/resource

Request parameter

Parameter nameTypeINRequiredDescription
space_idLonguritrueThe ID of the specified space.
only_subBooleanqueryfalseSpecifies whether to query only the direct child nodes.
last_row_keyLongqueryfalseThe starting ID of the query.
page_sizeIntegerqueryfalseThe number of items returned per page.

Return parameter

Parameter nameTypeDescription
successBooleanIndicates whether the request is successful. Valid values:
  • true: The operation succeeded.
  • false: The operation failed.
error_codeStringThe error code. For more information, see the error codes.
error_msgStringThe message that is returned if the request fails. It is empty if the request is successful.
resultObjectThe returned result.

Description of result

Parameter nameTypeDescription
dataListThe list of resources.
last_row_keyLongThe starting ID of the query.
page_sizeIntegerThe number of items returned per page.

Description of data

Parameter nameTypeDescription
res_idStringThe ID of the specified resource. Its meaning is determined by the resource type. For example, when the resource type is 0, this parameter represents a device, which is equivalent to device_id.
res_typeIntegerThe type of the specified resource.
  • 0: The resource is a device.

Request example

GET: /v2.0/cloud/space/15000***/resource?onlySub=true&lastRowKey=0&pageSize=100

Return example

{
    "result": {
        "last_row_key": 0,
        "data": [
            {
                "resType": 0,
                "resId": "vdevo167102917612***"
            },
            {
                "resType": 0,
                "resId": "vdevo167102921401***"
            }
        ],
        "page_size": 200
    },
    "success": true
}

Error code

For more information, see error code.

Limits on API Request Frequency

For more information, see Limits on API Request Frequency.