Sending events with duration

To send the duration of an event, you need to make two requests: at the start of the event and at the end of the event.

Events that do not overlap in time

Not overlapping events

After sending a completion request, the system will find the last incomplete event and complete it.

Sending on Start

You need to send GET or POST request:

curl -i

Sending on Finish

You need to send GET or POST request:

curl -i

You can omit the word complete and send your request without it:

curl -i

Events that overlap in time

Overlapping events

If you start several events at the same time, a call to the complete endpoint will find the last started event and complete it. It may not be the behavior you expect. When multiple events are running simultaneously, we recommend that you explicitly pass the ID of the event you want to complete.

We need to send starting request and got event ID from response:

curl -i
    "sensor": "40bb8708-16b5-47ca-a864...", // code of the sensor
    "event_id": 1057, // <-- ID of started event

Now we can explicitly send this event to complete endpoint:

$ curl -i

Please note that you can also pass a value at the start of an event or at the complete of an event. A value passed at the start can also be changed at the complete by simply passing a new value.