Eventi

I Dispositivi inviano eventi al Cloud ogni volta che si connettono e ogni volta che viene chiamato Trackle.publish(). E' possibile ricevere gli eventi dei dispositivi attraverso una tecnologia che sfrutta un flusso di dati HTTP chiamata Server-Sent Events (SSEs).

Puoi filtrare gli eventi da ricevere specificando un eventName. Gli eventi ricevuti saranno limitati a quelli con il filtro specificato. Per esempio specificando il nome evento temp saranno ricevuti tutti gli eventi il cui nome inizia con temp.

Ottieni un flusso di eventi pubblici

GET https://api.trackle.io/v1/events/[:eventName]

Open a stream of Server Sent Events for all public events.

Path Parameters

NameTypeDescription

eventPrefix

string

Filters the stream to only events starting with the specified prefix. Omit to get all events.

:ok

event: temperature
data: {"data":"25.34","ttl":"60","published_at":"2015-07-18T00:12:18.174Z","coreid":"0123456789abcdef0123456

Ottieni un flusso di eventi dei tuoi dispositivi

GET https://api.trackle.io/v1/devices/events/[:eventName]

Open a stream of Server Sent Events for all public and private events for your devices.

Path Parameters

NameTypeDescription

eventPrefix

string

Filters the stream to only events starting with the specified prefix. Omit to get all events.

:ok

event: temperature
data: {"data":"25.34","ttl":"60","published_at":"2015-07-18T00:12:18.174Z","coreid":"0123456789abcdef0123456

Ottieni un flusso di eventi per un dispositivo

GET https://api.trackle.io/v1/devices/:deviceID/events/[:eventName]

Open a stream of Server Sent Events for all public and private events for the specified device.

Path Parameters

NameTypeDescription

deviceID

string

Device ID

eventPrefix

string

Filters the stream to only events starting with the specified prefix. Omit to get all events.

:ok

event: temperature
data: {"data":"25.34","ttl":"60","published_at":"2015-07-18T00:12:18.174Z","coreid":"0123456789abcdef01234567"}

Ottieni un flusso di eventi di un prodotto

GET https://api.trackle.io/v1/products/:productIdOrSlug/devices/events/[:eventName]

Open a stream of Server Sent Events for all public and private events for a product.

Path Parameters

NameTypeDescription

productIdOrSlug

string

Product ID or Slug

eventPrefix

string

Filters the stream to only events starting with the specified prefix. Omit to get all events

:ok

event: temperature
data: {"data":"25.34","ttl":"60","published_at":"2015-07-18T00:12:18.174Z","coreid":"0123456789abcdef01234567"}

Ottieni un flusso di eventi di un dispositivo parte di un prodotto

GET https://api.trackle.io/v1/products/:productIdOrSlug/devices/:deviceID/events/[:eventName]

Open a stream of Server Sent Events scoped to a particular device in a product

Path Parameters

NameTypeDescription

productIdOrSlug

string

Product ID or Slug

deviceID

string

Device ID

eventPrefix

string

Filters the stream to only events starting with the specified prefix. Omit to get all events

:ok

event: temperature
data: {"data":"25.34","ttl":"60","published_at":"2015-07-18T00:12:18.174Z","coreid":"0123456789abcdef01234567"}

Pubblica un evento

POST https://api.trackle.io/v1/devices/events

Publish an event to your devices stream.

Request Body

NameTypeDescription

name

string

Event name

data

string

Event data. Limited to a maximum of 622 bytes

private

boolean

Private or public

{
  "ok": true
}

Pubblica un evento per un prodotto

POST https://api.trackle.io/v1/products/:productIdOrSlug/events

Publish an event that is sent to the product's event stream.

Path Parameters

NameTypeDescription

productIdOrSlug

string

Product ID or Slug

Request Body

NameTypeDescription

name

string

Event name

data

string

Event data. Limited to a maximum of 622 bytes

private

boolean

Private or public

{
  "ok": true
}

Last updated