Device payload count

I know I can see current month payload count per Application, but is there a similar value I could see payload per device when selecting one of the applications? Or is something like this available via the API?

We do allow for returning a given device’s payload counts for a time period through the API -

However, this is not exposed in the Losant user interface. You’ll need to make an API request to get the data.

Thanks ! that’s great.
I used the API Workflow node and just added in the required email in the JSON template and received an email with the downloadable report right away! Is that the default functionality? That’s great!

When looking at the numbers in the report and comparing to what’s shown on the “Application Info/Usage” page, it doesn’t add up with what I see on the report. Is that maybe just a timing issue of when it’s generated or is there any good explanation of how it adds up?

Can you please provide …

  • The device report, along with the device ID (including time range)
  • The application report, along with the application ID (including time range)
  • What you are expecting the device report to reflect

These statistics are aggregated approximately every 15 minutes, so if there is a minor discrepancy, that may be the cause.

Note that what is included in the device payload count is …

  • Connections to the MQTT broker
  • Disconnections from the MQTT broker
  • State reports
  • Commands sent to the device
  • Messages the device published to custom MQTT topics
  • Messages the device received on custom MQTT topics it subscribed to

The report showed this as below but Application info showed 688. Which combination of numbers do I add up?

Wait, I think I know. The default time range is a month, but Application info reset on 12/1. Sounds right?

When using the API directly, both device.payloadCounts and application.payloadCounts defaults to:

  • start: (now minus 30 days)
  • end: (now)

In the Losant user interface, under the “Usage” tab, we set the time range to:

  • start: (beginning of the current month)
  • end: (end of the current month)

ok, tried changing start and end time like this,
but debug message says this:

This is in reference to the payloadCounts endpoints? Because …

Yes, so I can not do this within a Losant API workflow node?

Wait, are you using the devices.payloadCounts endpoint (for returning payload counts for multiple devices)? To this point I’ve been assuming you’ve been using device.payloadCounts (for a single device) as that’s what I recommended originally.

Anyways, in that case, the schema for the request can be found here, and per that schema, start and end should be at the top level of the request body – not inside a query object as you have it here. So it should be …

  "email": "",
  "start": -129600000,
  "end": 0

And you may know this already, but just to make sure … unlike the single-device endpoint, the multi-device endpoint kicks off an asynchronous task to calculate the payload counts and then returns that value to the email or callbackUrl you provide in the request. It does not return the payload counts in the response body for the API request.