Querying the Resource Instance List
Function
This API is used to query the resource instance list.
URI
POST /v5/{project_id}/{resource_type}/resource-instances/filter
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID of a tenant in a region. For details, see Obtaining a Project ID. |
resource_type |
Yes |
String |
Resource type.
Enumerated values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
limit |
No |
Integer |
Number of records to be queried, which ranges from 1 to 1000. The default value is 1000. |
offset |
No |
Integer |
Index position. If offset is set to N, the resource query starts from the N+1 piece of data. The value is 0 by default, indicating that the query starts from the first piece of data. The value cannot be a negative number. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
MIME type of the request body. Use the default value application/json. For APIs used to upload objects or images, the value varies depending on the flow type. The default value is application/json. |
X-Auth-Token |
Yes |
String |
User token obtained from IAM. It is a response to the API for obtaining a user token. After a request is processed, the value of X-Subject-Token in the header is the token value. |
X-Language |
No |
String |
Request language type. Default value: en-us Enumerated values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
without_any_tag |
No |
Boolean |
If this parameter is set to true, all resources without tags are queried. In this case, the tags field is ignored. If this parameter is set to false or not specified, it does not take effect, which means that all resources are returned or resources are filtered by tags or matches. |
tags |
No |
Array of objects |
Included tags. A maximum of 20 keys are included. Each key can have a maximum of 20 values. For details, see Table 5. |
matches |
No |
Array of objects |
Search field. The tag key is the field to be matched, for example, resource_name. The tag value indicates the value to be matched. For details, see Table 6. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
total_count |
Integer |
Total number. |
resources |
Array of objects |
Resource list. For details, see Table 8. |
Parameter |
Type |
Description |
---|---|---|
resource_id |
String |
Resource ID. |
resource_detail |
String |
Resource details. The value is a resource object, used for extension. This parameter is left blank by default. |
resource_name |
String |
Resource name. |
tags |
Array of objects |
Tag list. For details, see Table 9. |
Example Request
Querying the instance list of a synchronization task
https://{endpoint}/v5/5237e10fe9aa4ad5b16b6a5245248314/sync/resource-instances/filter?limit=1000&offset=0 { "tags" : [ { "key" : "key1", "values" : [ "value1", "value2" ] }, { "key" : "key2", "values" : [ "value1", "value2" ] } ], "matches" : [ { "key" : "resource_name", "value" : "resource1" } ], "without_any_tag" : false }
Example Response
Status code: 200
OK
{ "resources" : [ { "tags" : [ { "key" : "aaaaa", "value" : "bbbbb" }, { "key" : "zzzz", "value" : "" } ], "resource_id" : "2f4af282-d13e-4b10-a1eb-609b47fjb201", "resource_detail" : "", "resource_name" : "DRS-5634" } ], "total_count" : 1 }
Status Code
Status Code |
Description |
---|---|
200 |
OK |
Error Code
For details, see Error Code.
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