Listening to PUBLIC events from a specified device

At present it is possible to listen to:

  • all public events of a particular type from all cores:

.

curl -sS -H "Authorization: Bearer {access_token}" https://api.spark.io/v1/events/yahi
  • all public and private events from a specified core, but only if the latter is claimed by the account whose API key is in use

.

curl -sS -H "Authorization: Bearer {access_token}" https://api.spark.io/v1/devices/{device_id}/events

It is not possible, but is potentially useful, to be able to listen to:

  • all public events from a specified core claimed by another account. As for second example above, but for a core claimed by a different account; instead of only providing the public events from the device, this currently returns an access denied error.

There is a workaround of course: take the full event stream of the intended type and only use the ones that are relevant.

curl -sS -H "Authorization: Bearer {access_token}" --no-buffer https://api.spark.io/v1/events/yahi | grep --line-buffered {device_id}

This has come up for Yahi because all of the cores are currently claimed by my account, but a couple of people are interested in being able to build applications which take the event stream for any one of the sensors in the network.

The workaround is sufficient for the moment, but please consider this a feature request.

1 Like

Hi @rolandturner,

Interesting idea! We could simply allow other users to watch the normal public endpoint for a core they don’t own, which doesn’t seem like it would be any kind of security or privacy issue, and would help prevent us from sending events that just get filtered out. I’ll add this to my backlog and update this thread when I add it. :slight_smile:

Thanks,
David

1 Like