Losant API Data Export Error

Good morning. I am contacting you to ask what is the cause of the error I am having working with the Losant API node with the “Resource and Action” Data Export.

You can see the node configuration in the following two screenshots.

image

The node is configured as the “View Example” recommends, but even though the export is done correctly, I get a csv file with no data in my email, as you can see below.

I have made the data export from the Devices > Request Data Export menu and the file I received is correct, with all the data. However, I am unable to make it work from the workflow. In addition, the fact that I can only do one test every hour slows down my work enormously. Although at the moment I am only passing a single device in:

“deviceIds”: [
"610b8e6ecea10c00
******"
],

I would like to pass it several devices. However, I have not been able to get it to work with either one or multiple devices.

Thank you, I look forward to hearing from you.

Best regards.

Hey @IoT_Hub,

Welcome to the Losant forums, we’re happy you’re here!

I did just do this exact thing just a few minutes ago and everything worked as expected for me. Would you be able to confirm that the device does have previous state reports? You can do this by going to the Data Explorer and selecting the device you are trying to export. Alternatively, you can go to the device’s overview page and look on the right-side panel at “Previous State Reports”.

Thank you,
Heath

@IoT_Hub,

My apologies. It looks like I misread the part where you said that you were able to successfully request the data export from the Request Data Export menu correctly.

I am taking a closer look now for you and will follow up shortly.

Thank you,
Heath

1 Like

Hello. Have you had any success trying to find out why the node is unable to provide the same result as the menu? Is there a problem with the format of the JSON to be written?

Thanks for your time

@IoT_Hub here’s my best guess as to what’s going on …

  • In the user interface, when you choose the “Request Data Export” option on the device list, we default the start of the export period to 24 hours prior.
  • However, the Data: Export endpoint actually defaults to a duration of one hour prior to the provided “end” when a “start” property is not provided.
  • Therefore, I believe you are properly receiving a data export for the device’s last hour of data, and there is no data to export within that window.

Try providing a “start” property in your Losant API Node, and set it to a timestamp far enough in the past that you know will return data, and see if you get rows in your data export file then.

Heelo Dylan, thanks for your response. I have tried this:
image

But again, i keep obtaining an empty csv. Maybe I should enter the data in other format? What I have done now is to enter the time in unix in seconds with a difference of 24 hours between START and END, but again, nothing.

Thank you again for your response, I will keep trying to make it work anyways

Sorry, I should have clarified this before: Your start and end values need to be passed as millisecond timestamps, not second timestamps. So if you just add three zeroes (000) to the end of your start and end values, that should fix it.

1 Like

Finally, it worked!

Thank you very much for your time and your attention

1 Like