Subscribing to Tracker Product stream like a Device Stream?

I’m working with a Tracker One for the first time and am seeing that it seems different than other Particle products.

With something like an Argon I can use a continuously running node app to do getEventStream and pull data and throw it into a custom database as they come in via the /device api

But with the Tracker, it seems like I have to do a “get” via the /products api, which returns the most current value.

Question #1: Is there a way to subscribe to a Tracker stream, or do I have to ‘loop’ and get the data via the products api, unless I wanted to update the firmware on the Tracker.

Question #2: Is there any plans for future ‘hooks’ that will allow a getEventStream() type action for the Tracker products?

Thanks.

The Tracker is different only because it always must be in a product, not an isolated developer device.

You can get the product event stream in almost the same way as the regular event stream. It’s also a SSE stream.

Basically, instead of subscribing to https://api.particle.io/v1/devices/events you subscribe to https://api.particle.io/v1/products/1234/events where 1234 is the product ID of the Tracker product.

2 Likes

Thank you! I’m now seeing the streaming data when I go to:
https://api.particle.io/v1/products/[productId]/events

Right now we only have one Tracker for testing.

If we use the “product id” (as shown in the screenshot below), if we add another device, won’t that show all the devices on the same page? I didn’t think the “product id” was a unique ID. Shouldn’t I be using the “Slug” to get data for a specific device?

There’s a one-to-one mapping between product ID (numeric) and slug so you can mostly use them interchangeably, however there are a few APIs that only work with the numeric ID, so you might as well just always use the numeric IDs.

Yes, if you add more trackers to the same product, they will all show up on the same page in the console. The console is not intended as an end-user map visualization, it’s designed so the device fleet owner can see where all of their devices are.

1 Like

Got it working. Thank you so much for the help.