Sending Events using REST API
The Event Engine feature allows you to send Events using the REST API.
-
Endpoint:
/analytics/api/v1/events/
-
HTTP Method:
POST
-
Required headers:
Authorization: client-specific API key that is created using the apikeys endpoint. See the section Authentication and Key Management: Analytics REST API - General Info
Content-Type: application/json
-
Payload:
Event Object or Array of Event Objects
Event Object (JSON object, take from RAML)
Attribute | Description | Format | Example |
---|---|---|---|
type | Name of the Event(name of the AE object defining the event in the ae) | String | EVNT.MESSAGE |
timestamp | Event timestamp | ISO 8601, yyyy-mm-ddThh:mm:ss.ffffff | 2017-06-20T11:07:10.898Z |
values | JSON | JSON object (flat, no nested objects supported) | { "text": "value", "id": 2, "success": true } |
Example
HTTP request for a single event
POST /analytics/api/v1/events/ HTTP/1.1 Host: localhost:8090 Authorization: f57c7a25-acc6-4f64-a6bb-933c9b2bc3a3 Content-Type: application/json Cache-Control: no-cache { "type": "EVNT.MESSAGE", "timestamp":"2017-06-20T11:07:10.898Z", "values": { "text": "value", "id": 3, "success": true } }
Example
Multiple events in one request (used by collectors that only check every N minutes and therefore often find/send multiple events
POST /analytics/api/v1/events/ HTTP/1.1 Host: localhost:8090 Authorization: f57c7a25-acc6-4f64-a6bb-933c9b2bc3a3 Content-Type: application/json Cache-Control: no-cache [ { "type": "EVNT.MESSAGE", "timestamp":"2017-06-20T11:07:10.898Z", "values": { "text": "first message", "id": 3, "success": true } }, { "type": "EVNT.MESSAGE", "timestamp":"2017-06-20T12:07:10.998Z", "values": { "text": "New message", "id": 3, "success": false } } ]