Querying the Number of Resources
Function
This API is used to query the number of resources.
URI
- POST /v3/sfs/tms/{project_id}/file-systems/resource-instances/count
- Parameter description
Parameter
Mandatory
Type
Description
project_id
Yes
String
The project ID. For details, see Obtaining a Project ID.
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-type |
Yes |
String |
The MIME type of the request body. Example: application/json |
X-Auth-Token |
No |
String |
The user token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
without_any_tag |
No |
boolean |
Excludes resources with any of the specified tags. 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 |
List<tag> |
The resources to be queried contain tags listed in tags. Each resource to be queried can contain a maximum of 20 tag keys, and each key can have a maximum of 20 values. The tag value of a tag key can be an empty array but the structure cannot be missing. Each tag key must be unique, and the tag values of a key must also be unique. The response returns resources containing all tags in this list. Keys in this list are in an AND relationship while values in each key-value structure is in an OR relationship. If this parameter is not specified, all resources will be returned. For details, see Table 3. |
sys_tags |
No |
List<tag> |
Contains system tags. This parameter is only available to users with the op_service permission. This parameter cannot be used with filtering criteria without_any_tag and tags at the same time. This field contains only one tag structure currently. The key is fixed at _sys_enterprise_project_id. The value is the ID of an enterprise project. The key contains only one value. Value 0 indicates the default enterprise project. For details, see Table 3. |
matches |
No |
List<match> |
The fields to be matched. The key in match is a dictionary value fixed at resource_name, meaning that the prefix search is performed based on the value of the key. It will be extended later. For details, see Table 4. |
Response Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
total_count |
Yes |
Integer |
The total number of records. |
Example Request
Querying the number of resources using project ID **c80a2157ba1d46c0825265947342077c**:
POST https://{endpoint}/v3/sfs/tms/c80a2157ba1d46c0825265947342077c/file-systems/resource-instances/count
Request body example:
{ "tags":[ { "key":"key1", "values":[ "value1", "value2" ] }, { "key":"key2", "values":[ "value1", "value2" ] } ], "matches":[ { "key":"resource_name", "value":"resource1" } ], "without_any_tag":"true" }
Example Response
{ "total_count":1 }
Status Codes
- Normal
Status Code |
Description |
---|---|
200 |
Number of resources queried. |
- Abnormal
Status Code |
Description |
---|---|
400 |
Invalid tag parameter. |
401 |
Certification failed. |
403 |
Authentication failed. |
404 |
Resource not found. |
500 |
System error. |
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