Skip to main content

Create an event

Request

Create an event associated with a device. Provide a device ID or name.

Security
ApiKey(Required scopes: events.create)
Bodyapplication/jsonrequired
deviceIdstring

ID of the device to associate with the event

deviceNamestring

Name of the device to associate with the event

projectIdstring

Optional project ID used to disambiguate deviceName and deviceId lookups

metadataobject(EventMetadataInput)

An object with user-defined string keys and string values; key order is not preserved

startstring, (date-time)required

Event start time (inclusive)

endstring, (date-time)required

Event end time (inclusive)

eventTypeIdstring

If provided, the event must conform to the event type's schema.

propertiesobject(CustomPropertyValues)

A key-value map, where each key is one of your pre-defined event custom property keys. Keys which are not recognized as custom properties will be ignored.

device.idstringdeprecated

Equivalent to deviceId, and ignored if deviceId is supplied

device.namestringdeprecated

Equivalent to deviceName, and ignored if deviceName is supplied

from foxglove.client import Client
from datetime import datetime, timedelta

token = "<YOUR API TOKEN HERE>"
client = Client(token=token)

event_time = datetime.now()

client.create_event(
    device_id=device_id,
    start=event_time,
    end=event_time,
    metadata={"message": "Hi from python!"}
)

Responses

The created event

Bodyapplication/json
idstringrequired

ID of the event

startstring, (date-time)required

Event start time (inclusive)

endstring, (date-time)required

Event end time (inclusive)

deviceobject(DeviceSummary)

ID and name of a device.

metadataobjectrequired

Any metadata associated with the event

createdAtstring, (date-time)required

When the event was created

updatedAtstring, (date-time)required

When the event was last updated

eventTypeIdstring

ID of the event type.

propertiesobject(CustomPropertyValues)

A key-value map of the custom properties associated with this event.

deviceIdstringdeprecated

ID of the device associated with the event.

deprecated: Use device.id instead.

Response
{ "id": "string", "start": "2019-08-24T14:15:22Z", "end": "2019-08-24T14:15:22Z", "deviceId": "string", "device": { "id": "string", "name": "string" }, "metadata": {}, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "eventTypeId": "string", "properties": { "property1": "string", "property2": "string" } }