Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
project_id |
Yes |
String |
Project ID |
resource_type |
Yes |
String |
Resource type Only smn_topic (topic) is supported. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
tags |
No |
Tags structure array |
Includes specified tags. For details, see Table 1. NOTE:
The structure body is mandatory. A maximum of 20 tag keys are allowed in each query operation. The tag key cannot be left blank or set to the empty string. Each tag key can have up to 20 tag values. Each tag key and tag values of one key must be unique. Resources identified by different keys are in AND relationship. |
tags_any |
No |
Tags structure array |
Includes any of the specified tags. For details, see Table 1. NOTE:
The structure body is mandatory. A maximum of 20 tag keys are allowed in each query operation. The tag key cannot be left blank or set to the empty string. Each tag key can have up to 20 tag values. Each tag key and tag values of one key must be unique. Resources identified by different keys are in OR relationship. |
not_tags |
No |
Tags structure array |
Excludes specified tags. For details, see Table 1. NOTE:
The structure body is mandatory. A maximum of 20 tag keys are allowed in each query operation. The tag key cannot be left blank or set to the empty string. Each tag key can have up to 20 tag values. Each tag key and tag values of one key must be unique. Resources identified by different keys are in NAND relationship. |
not_tags_any |
No |
Tags structure array |
Excludes any of the specified tags. For details, see Table 1. NOTE:
The structure body is mandatory. A maximum of 20 tag keys are allowed in each query operation. The tag key cannot be left blank or set to the empty string. Each tag key can have up to 20 tag values. Each tag key and tag values of one key must be unique. Resources identified by different keys are in NOR relationship. |
limit |
No |
String |
The maximum number of resources to be queried
|
offset |
No |
String |
Start location of pagination query. The query starts from the next resource of the specified location. You do not need to specify this parameter when you query resources on the first page. When you query resources on subsequent pages, set this parameter to the location returned in the response body for the previous query.
|
action |
Yes |
String |
Operation to be performed. The operation can be filter or count (case-sensitive). filter: queries resources in pages based on filter conditions. count: queries the total number of resources meeting filter conditions. |
matches |
No |
Match condition structure array |
Key-value pair to be matched The only supported key is resource_name. The value will be exactly matched. |
POST https://{SMN_Endpoint}/v2/{project_id}/{resource_type}/resource_instances/action
{
"offset": "100",
"limit": "100",
"action": "filter",
"matches":[
{
"key": "resource_name",
"value": "resource1"
}
],
"not_tags": [
{
"key": "key1",
"values": ["*value1","value2"]
},
{
"key": "key2",
"values": ["*value21","value22"]
}
],
"tags": [
{
"key": "key1",
"values": ["*value1","value2"]
}
],
"tags_any": [
{
"key": "key1",
"values": ["value1", "value2"]
}
],
"not_tags_any": [
{
"key": "key1",
"values": ["value1", "value2"]
}
]
}
{
"action": "count",
"not_tags": [
{
"key": "key1",
"values": ["value1", "*value2"]
}
],
"tags": [
{
"key": "key1",
"values": ["value1", "value2"]
}
],
"tags_any": [
{
"key": "key1",
"values": [ "value1", "value2"]
}
],
"not_tags_any": [
{
"key": "key1",
"values": ["value1", "value2"]
}
],
"matches":[
{
"key": "resource_name",
"value": "resource"
}
]
}
Parameter |
Type |
Description |
|---|---|---|
resources |
Resource structure array |
For details, see Table 2. |
total_count |
Integer |
Total number of resources. |
Parameter |
Type |
Description |
|---|---|---|
resource_id |
String |
Resource ID |
resource_detail |
Object |
Resource details Resource object used for extension. resource_detail is left blank by default. For topic resources, the value of this field is {"topic_urn":"${TopicUrn}","display_name":"display name"}. For other resources, the value is null. |
tags |
Resource_tag structure array |
List of queried tags. If no tag is matched, an empty array is returned. For details, see Table 3. |
resource_name |
String |
Resource name |
Response body when action is set to filter
{
"resources": [
{
"resource_detail": {
"topic_urn":"urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:resource1",
"display_name":"testtest"
},
"resource_id": "cffe4fc4c9a54219b60dbaf7b586e132",
"resource_name": "resource1",
"tags": [
{
"key": "key1",
"value": "value1"
}
]
}
],
"total_count": 1000
}
Response body when action is set to count
{
"total_count": 1000
}
See Returned Value.
See Error Codes.