QueryEventSubscription

API Request

URLs
GET zstack/v1/zwatch/events/subscriptions
GET zstack/v1/zwatch/events/subscriptions/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/zwatch/events/subscriptions?q=name=test
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/zwatch/events/subscriptions/57618e9763ce3b7e990870c3a7ae8c53

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryEventSubscription, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "9404fe697a6b4d7dbac98065af20dc57",
      "namespace": "ZStack/VM",
      "eventName": "org.zstack.zwatch.datatype.EventFamily@80723ca",
      "state": "Enabled",
      "actions": [
        {
          "subscriptionUuid": "650cf6a269284671a42f93631c87dfec",
          "actionType": "sns",
          "actionUuid": "fe296dcbc31c4afa9f76494b1930c8cc"
        }
      ],
      "labels": [
        {
          "uuid": "d29fe54ca47540a9b20b308429f21434",
          "key": "DestinationHostUuid",
          "operator": "Equal",
          "value": "733509c8c5684c678ffe99f59d4aba21"
        }
      ],
      "lastOpDate": "Jul 6, 2018 1:51:00 PM",
      "createDate": "Jul 6, 2018 1:51:00 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.3.1
inventories List See inventories. 2.3.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.3.1
description String The brief description of the error. 2.3.1
details String The details about the error. 2.3.1
elaboration String The reserved field. Default value: null. 2.3.1
opaque LinkedHashMap The reserved field. Default value: null. 2.3.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.3.1
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 2.3.1
name String Th resource name. 3.0.0
namespace String The namespace. 2.3.1
eventName String The event name. 2.3.1
lastOpDate Timestamp The creation date. 2.3.1
createDate Timestamp The last operation date. 2.3.1
state EventSubscriptionState See state. 2.3.1
actions List See actions. 2.3.1
labels List See labels. 2.3.1
#state
Name Type Description Starting Version
name String The resource name. 2.3.1
ordinal int 2.3.1
#actions
Name Type Description Starting Version
subscriptionUuid String The event subscription UUID. 2.3.1
actionType String The action type. 2.3.1
actionUuid String The action UUID. 2.3.1
#labels
Name Type Description Starting Version
uuid String The resource UUID. 2.3.1
key String The label key. 2.3.1
value String The label value. 2.3.1
operator Operator See operator. 2.3.1
#operator
Name Type Description Starting Version
op String 2.3.1
name String The resource name. 2.3.1
ordinal int 2.3.1

SDK Sample

Java SDK
QueryEventSubscriptionAction action = new QueryEventSubscriptionAction();
action.conditions = asList("name=test");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryEventSubscriptionAction.Result res = action.call();
Python SDK
QueryEventSubscriptionAction action = QueryEventSubscriptionAction()
action.conditions = ["name=test"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryEventSubscriptionAction.Result res = action.call()