GetResources

Updated at:

Queries resources.

Operation description

You can use API Explorer to view resource documentation and try out Cloud Control API.

This API supports both get and list operations on resources. The request path determines which operation is performed.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

GET /api/v1/providers/{provider}/products/{product}/resources/* HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

requestPath

string

No

The request path.

You can invoke the List or Get operation based on the request path.

  • List: /api/v1/providers/{provider}/products/{product}/resources/{resourceType}

  • Get: /api/v1/providers/{provider}/products/{product}/resources/{resourceType}/{resourceId}

The request path contains the following variables:

  • provider: the cloud provider. Only Aliyun is supported.

  • product: the product code.

  • resourceType: the resource type. If a parent resource exists, the format is {parent resource type code}/parent resource ID/{resource type code}.

  • resourceId: the resource ID.

List (no parent resource): /api/v1/providers/Aliyun/products/Redis/resources/DBInstance List (has parent resource): /api/v1/providers/aliyun/products/Redis/resources/DBInstance/r-2ze8v41uei31lo****/Account Get (no parent resource): /api/v1/providers/Aliyun/products/Redis/resources/DBInstance/r-2ze8v41uei31lo**** Get (has parent resource): /api/v1/providers/Aliyun/products/Redis/resources/DBInstance/r-2ze8v41uei31lo****/Account/user****

Request parameters

Parameter

Type

Required

Description

Example

regionId

string

No

The region ID. This parameter is required if the cloud service is region-specific.

cn-beijing

filter

object

No

The resource filter conditions.

This parameter supports multiple key-value pairs in JSON format to filter resources. When you perform a list or get operation on resources of a cloud service, if the operation supports filtering by specific attributes, you can use these attributes as filter conditions.

Note

The supported filter fields may vary based on the resource type. For more information about the supported fields, see the OpenAPI documentation for the corresponding resource.

For example, DBInstance resources can be filtered by the EditionType and PaymentType fields.

{ "EditionType": "Community", "PaymentType": "PostPaid" }

nextToken

string

No

The pagination cursor.

  • You do not need to specify this parameter for the first query. The system returns the first page of data by default.

  • For subsequent queries, you must pass the nextToken value returned from the previous call.

Note

If the parameter value contains only digits, Cloud Control API treats it as the PageNumber for pagination.

AAAAAdDWBF2****

maxResults

integer

No

The maximum number of records to return per page. Maximum value: 100.

10

Response elements

Element

Type

Description

Example

object

The response structure.

maxResults

integer

The maximum number of entries returned in this request. Returned for the list operation.

10

nextToken

string

The position where the current call stops reading. An empty value indicates that all data has been read. Returned for the list operation.

AAAAAdDWBF2****

requestId

string

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

resource

object

The specified resource. Returned for the get operation.

resourceAttributes

object

The resource attributes in JSON format.

{"Status":"Available","Description":"","AccountPrivilege":"RoleReadWrite","InstanceId":"r-2ze8v41uei31lo****","RegionId":"cn-zhangjiakou","AccountType":"Normal","TypeInfo":{},"AccountName":"cctest"}

resourceId

string

The resource ID.

cctest

resources

array<object>

The resources. Returned for the list operation.

array<object>

The resource.

resourceAttributes

object

The resource attributes in JSON format.

{"Status":"Available","Description":"","AccountPrivilege":"RoleReadWrite","InstanceId":"r-2ze8v41uei31lo****","RegionId":"cn-zhangjiakou","AccountType":"Normal","TypeInfo":{},"AccountName":"cctest"}

resourceId

string

The resource ID.

cctest

totalCount

integer

The total number of entries that meet the request conditions. Returned for the list operation.

20

Examples

Success response

JSON format

{
  "maxResults": 10,
  "nextToken": "AAAAAdDWBF2****",
  "requestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "resource": {
    "resourceAttributes": {
      "Status": "Available",
      "Description": "",
      "AccountPrivilege": "RoleReadWrite",
      "InstanceId": "r-2ze8v41uei31lo****",
      "RegionId": "cn-zhangjiakou",
      "AccountType": "Normal",
      "TypeInfo": {},
      "AccountName": "cctest"
    },
    "resourceId": "cctest"
  },
  "resources": [
    {
      "resourceAttributes": {
        "Status": "Available",
        "Description": "",
        "AccountPrivilege": "RoleReadWrite",
        "InstanceId": "r-2ze8v41uei31lo****",
        "RegionId": "cn-zhangjiakou",
        "AccountType": "Normal",
        "TypeInfo": {},
        "AccountName": "cctest"
      },
      "resourceId": "cctest"
    }
  ],
  "totalCount": 20
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.