User Tools

Site Tools


version_3:post_events_update

Sending new event data

An event consists of an action (START, UPDATE or END), a type, the timestamp when the event happened and an arbitrary amount of key-value pairs as entities. This interface of the service is able to process as much events as a POST request is able to handle.

The variable session is optional for single START and UPDATE events. It is required for START-(UPDATE-)END-pairs so that the events can be grouped. The session is identified by a string of the length 8 to 20 characters.

Authentication required

Yes, please take a look at Authentication. To keep it simple, only the data parameter is mentioned on this page, but keep in mind that the other parameters are also necessary.

Response

JSON

Method

POST

Resource URL

Parameters

The sent JSON object data consists of an array of events. It is not possible to just send one event, it has to be an array of event(s). One event should contain the following parameters:

action

Can be START, UPDATE or END. For recurring events, like the changes in the position, UPDATE should be used. If there is a start and end point, like the usage of a certain application, START and END should be used.

type

The service knows a fixed number of types. As a developer, you have to decide which type to choose for an event.

timestamp

The (UNIX) timestamp when the event happened.

session

A random string, 8-20 characters long. It is used to identify events that contentual belong together. This is true for events that have a start and an end. Otherwise, it is optional.

entities

This is an array of arbitrary length containing key-value pairs which can be used to describe the event (what happened). One entity consists of two parameters:

key

The key (String) is the name of the variable.

value

The value of the variable, can be of any type, from Integer to String to Binary.

Example

Request

data=[
   {
      "action":"START",
      "type":"APPSTART",
      "timestamp":1365772427,
      "session":"8nc92io9q",
      "entities":[
         {
            "key":"app",
            "value":"BigBrother"
         },
         {
            "key":"package",
            "value":"de.thues.bigbrother"
         }
      ]
   },
   {
      "action":"END",
      "type":"APPSTART",
      "timestamp":1365772533,
      "session":"8nc92io9q",
      "entities":[
         {
            "key":"app",
            "value":"BigBrother"
         },
         {
            "key":"package",
            "value":"de.thues.bigbrother"
         }
      ]
   }
]

Response

{
   "APIVersion":3,
   "result":1
}

In case of an error, a different response is sent. Please take a look at Error Responses.

version_3/post_events_update.txt · Last modified: 01.05.2016 22:57 (external edit)