Add Events
Add Event Data of Devices
Make sure that event data, which shall be taken into consideration by MOOST Recommender Platform, are forwarded to MOOST via MOOST API.
See Event Types to get an overview which events should be forwarded for which devices in which periodicity.
Event Data Structure
Following example depicts an event structure of a energy consumption event.
{
"id": "6703cfa2fa7bfc35eb1f74d0",
"customerId": "656730be2bc9719e6e5ed51d",
"customerBuildingId": "99900000C048ADA6",
"deviceId": "c8f09e83046c",
"deviceName": "Sinemaa main meter",
"source": "GATEWAY",
"type": "ENERGY_CONSUMPTION",
"value": 858.71,
"timestamp": 1727992800000
}
Data Structure Attributes
id
The event ID on MOOST side (is generated when inserting a new event)
customerId
The ID of the customer (cannot be set or change)
customerBuildingId
The building ID on customer side
deviceId
The ID of the device which is producing this event (should refer to the device within the building, see Building Data Structure
deviceName
The name of the device which is producing this event. Remark: if devices have not an own name, the product name can be used.
source
The device which is related to this event. See Device Types
Remark: device type GATEWAY
is used, when this is a data point for the whole household / building.
type
The event type of this event. This value also implies the data unit. See Event Types
value
The value of the event datapoint. Remark: must be a number
timestamp
Time of the event (Epoch Time in seconds (UTC))
Add an Event
For sending new Events to the MOOST Recommender Platform the below endpoint can be used.
^[a-zA-Z0-9]{24}$
^[a-zA-Z0-9:._-]{1,100}$
^[a-zA-Z0-9:._-]{3,64}$
^.{1,100}$
POST /events/v1 HTTP/1.1
Host: api.moost.io
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 200
{
"timestamp": 1,
"customerId": "text",
"customerBuildingId": "text",
"deviceId": "text",
"deviceName": "text",
"value": 1,
"type": "CHARGING_MODE",
"source": "APPLIANCE",
"forecastTimestamp": 1,
"ingestionTimestamp": 1
}
Created
No content
Example with CURL
# make sure ACCESS_TOKEN is set and valid (see "Request Access Token")
curl -X POST "https://api.moost.io/events/v1" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"timestamp\":1657029000,\"customerId\":\"656730be2bc9719e6e5ed51d\",\"customerBuildingId\":\"999000009C54AAAA\",\"deviceId\":\"17306deb97e0f94609f13e22\",\"deviceName\":\"Device Link Car\",\"value\":99.9,\"type\":\"STATE_OF_CHARGE_RATE\",\"source\":\"CAR\"}"
Add a batch of historical events
In case you want to add a batch of historical events, following endpoint can be used.
Remark: historical events will not be processed by the rule engine during insertion.
Inserts historical events to the database. I.e. these events are not processed by the rule engine when receiving these events.Event customerId has to be in-line with customerId of the JWT).
^[a-zA-Z0-9]{24}$
^[a-zA-Z0-9:._-]{1,100}$
^[a-zA-Z0-9:._-]{3,64}$
^.{1,100}$
POST /events/historical/v1 HTTP/1.1
Host: api.moost.io
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 202
[
{
"timestamp": 1,
"customerId": "text",
"customerBuildingId": "text",
"deviceId": "text",
"deviceName": "text",
"value": 1,
"type": "CHARGING_MODE",
"source": "APPLIANCE",
"forecastTimestamp": 1,
"ingestionTimestamp": 1
}
]
No content
Last updated