Device Event Queries
Subscriber, group, and device event queries query the in-memory event database. You can include optional parameters in the URL to filter the results. For information about querying the event database and the Event Repository, see the discussion about the event REST APIs.
Optional Parameters
Parameter | Datatype | Description |
---|---|---|
querySize | unsigned int32 | querySize (default is 0=system default) determines the number of records returned per call. |
queryCursor | unsigned int64 | If the query results do not fit in a single response, a QueryCursor is included in the response. If the cursor is NULL or 0, the list is complete. If there are additional entries in the list, you can retrieve the subsequent pages of the response by calling this URL again and specifying a queryCursor parameter on the url. |
eventTimeLowerBound | datetime | Specifies the lower bound of the event time range used to filter the query results. Events whose event time is greater than or equal to the lower bound are returned. |
eventTimeUpperBound | datetime | Specifies the upper bound of the event time range used to filter the query results. Events whose event time is less than the upper bound are returned. |
eventTypes | string | Events whose event type prefix matches the specified types are returned.
Separate event types with a comma. The
EventTypeArray in the
MtxPrimaryEvent
MDC defines the event type that was initiated, representing
it numerically in the MDC as an array of strings such as
"4", "1.2", or "1.3.5". The top-level event types are:
|
EventTypeArray | Array of String | Events whose event type prefix matches one of the specified types will be returned. Event types are like "4", "1.2", or "1.3.5". |
Query Size
The following query with querySize
and queryCursor
parameters limits the query size to two events and begins the query at the specified cursor value which was returned in a previous query.
GET http://host:port/rsgateway/data/v3/group/1-2-3-4/events/?querySize=2&queryCursor=1125899907043728
Event DateTime Range
The following query with the eventTimeLowerBound
parameter gets events which occurred after 2016-08-01 00:00:00 PDT for a subscriber with OID 1-2-3-4.
GET http://host:port/rsgateway/data/v3/subscriber/1-2-3-5/events?eventTimeLowerBound=2016-08-01T00%3A00%3A00-07%3A00
Query by eventType
The following query with the
eventType
parameter gets events with event type prefix 4 and 1.2. GET http://host:port/rsgateway/data/v3/device/1-2-3-6/events?eventTypes=4,1.2
This query returns events for device 1-2-3-6 with the following event types:
- 4
- 4.1
- 4.2
- 1.2.1
- 1.2.2
Sample Event Query Responses
XML
<MtxResponseEventInfo>
<EventList>
<MtxPurchaseEvent>
<OfferInfoArray>
<MtxPurchaseEventOfferInfo>
<CatalogItemId>2</CatalogItemId>
<CatalogItemExternalId>9</CatalogItemExternalId>
<CatalogItemTemplateAttr>
<MtxTemplateAttr />
</CatalogItemTemplateAttr>
<OfferId>2</OfferId>
<OfferVersion>0</OfferVersion>
<ExternalId>9</ExternalId>
<ResourceId>1</ResourceId>
<StartTime>0001-01-01T00:00:00.000000Z</StartTime>
<EndTime>65535-12-31T23:59:59.999999Z</EndTime>
</MtxPurchaseEventOfferInfo>
</OfferInfoArray>
<EventTypeArray>
<value>4</value>
</EventTypeArray>
<InitiatorId>0-1-5-24</InitiatorId>
<InitiatorExternalId>123</InitiatorExternalId>
<Flags>0</Flags>
<WalletId>0-1-5-25</WalletId>
<WalletOwnerId>0-1-5-24</WalletOwnerId>
<WalletOwnerExternalId>123</WalletOwnerExternalId>
<EventTime>2017-10-17T02:21:44.000471Z</EventTime>
<EventId>GLDQA_0:1:52:45</EventId>
<DeleteCode>2</DeleteCode>
</MtxPurchaseEvent>
<MtxPurchaseEvent>
<OfferInfoArray>
<MtxPurchaseEventOfferInfo>
<CatalogItemId>2</CatalogItemId>
<CatalogItemExternalId>9</CatalogItemExternalId>
<CatalogItemTemplateAttr>
<MtxTemplateAttr />
</CatalogItemTemplateAttr>
<OfferId>2</OfferId>
<OfferVersion>0</OfferVersion>
<ExternalId>9</ExternalId>
<ResourceId>2</ResourceId>
<StartTime>0001-01-01T00:00:00.000000Z</StartTime>
<EndTime>65535-12-31T23:59:59.999999Z</EndTime>
</MtxPurchaseEventOfferInfo>
</OfferInfoArray>
<EventTypeArray>
<value>4</value>
</EventTypeArray>
<InitiatorId>0-1-5-24</InitiatorId>
<InitiatorExternalId>123</InitiatorExternalId>
<Flags>0</Flags>
<WalletId>0-1-5-25</WalletId>
<WalletOwnerId>0-1-5-24</WalletOwnerId>
<WalletOwnerExternalId>123</WalletOwnerExternalId>
<EventTime>2017-10-17T02:22:08.731478Z</EventTime>
<EventId>GLDQA_0:1:52:46</EventId>
<DeleteCode>2</DeleteCode>
</MtxPurchaseEvent>
</EventList>
<QueryCursor>0</QueryCursor>
<RouteId>1</RouteId>
<Result>0</Result>
<ResultText>OK</ResultText>
<ResultType>GET</ResultType>
</MtxResponseEventInfo>
JSON
{
"$": "MtxResponseEventInfo",
"EventList": [
{
"$": "MtxPurchaseEvent",
"DeleteCode": 2,
"EventId": "GLDQA_0:1:52:45",
"EventTime": "2017-10-17T02:21:44.000471Z",
"EventTypeArray": [
4
],
"Flags": 0,
"InitiatorExternalId": "123",
"InitiatorId": "0-1-5-24",
"OfferInfoArray": [
{
"$": "MtxPurchaseEventOfferInfo",
"CatalogItemExternalId": "9",
"CatalogItemId": 2,
"CatalogItemTemplateAttr": {
"$": "MtxTemplateAttr"
},
"EndTime": "65535-12-31T23:59:59.999999Z",
"ExternalId": "9",
"OfferId": 2,
"OfferVersion": 0,
"ResourceId": 1,
"StartTime": "0001-01-01T00:00:00.000000Z"
}
],
"WalletId": "0-1-5-25",
"WalletOwnerExternalId": "123",
"WalletOwnerId": "0-1-5-24"
},
{
"$": "MtxPurchaseEvent",
"DeleteCode": 2,
"EventId": "GLDQA_0:1:52:46",
"EventTime": "2017-10-17T02:22:08.731478Z",
"EventTypeArray": [
4
],
"Flags": 0,
"InitiatorExternalId": "123",
"InitiatorId": "0-1-5-24",
"OfferInfoArray": [
{
"$": "MtxPurchaseEventOfferInfo",
"CatalogItemExternalId": "9",
"CatalogItemId": 2,
"CatalogItemTemplateAttr": {
"$": "MtxTemplateAttr"
},
"EndTime": "65535-12-31T23:59:59.999999Z",
"ExternalId": "9",
"OfferId": 2,
"OfferVersion": 0,
"ResourceId": 2,
"StartTime": "0001-01-01T00:00:00.000000Z"
}
],
"WalletId": "0-1-5-25",
"WalletOwnerExternalId": "123",
"WalletOwnerId": "0-1-5-24"
}
],
"QueryCursor": 0,
"Result": 0,
"ResultText": "OK",
"RouteId": 1,
"_resultCode": 0,
"_resultText": "OK",
"_resultType": "get"
}