Exporting data to an URL

Hi!
I have a device connected to losant platform and, in general, i can easily deal with its data, since the documentation is very clear about it.
However, there is something i still have trouble doing: exporting the data to an URL (an API returning my attribute values, for example).
I tried using the POST method on the HTTP Node, but when I access the URL, it only returns {“success”:true}.

Basically what i’m trying to do is the opposite of the Weather Station “grabber” workflow: instead of grabbing the attributes from an API and putting it in the platform, I want to grab the attributes from my device and put it on an API. What’s the easiest way to do it?

Hi @Cesar_Guedes, and welcome to the Losant Forums.

It is absolutely possible to send data from Losant to a third party API, but the best way to do so depends on a number of factors:

  • Do you want to send the data in real time as it’s being reported to Losant, in small batches on a regular basis, or in large batches infrequently?
  • What is the other service in question? Do they only expose an HTTP API or are there other methods of ingesting data into it?
  • Out of curiosity, what are you doing with the data in the third-party service? I ask this because I wonder if there is a hole in our product offering that we could fill.

Please let me know, and again, welcome to Losant!

Thank you for your time!

  • Precisely, I would like to send data from my device every 15 minutes;

  • I just need the API to return me the current device attributes, in JSON format, for example (I have already succeeded in exporting data periodically in CSV format to my e-mail or AWS, since the documentation is very clear about it);

  • I’m doing this just because i’m still learning some aspects of programming and I rather do it first outside the platform just so I don’t mess up my application, it’s not really a lack of possibilities from Losant.

I’d set up a workflow that starts with a Timer Trigger configured to fire on your interval (every 15 minutes).

From there, you can retrieve device data a number of different ways …

  • Data: Time Series Node: For returning a time range of data from a single attribute across one or many devices
  • Data: Gauge Query Node: For returning a single value from a single attribute aggregated across one or many devices
  • Device: Get Node: With the “Composite State” option, this will return one or more devices along with the last reported state values for your selection of attributes
  • Losant API Node, Data: Time Series Query action: For returning a time range of data across one or more devices and for one or more attributes
  • Losant API Node, Data: Last Value Query action

From there, you may need one or more nodes to shape the retrieved data into a format your third-party API expects.

Finally, you can submit the data to your API using a properly configured HTTP Node. What this looks like depends on the API you are interacting with.

Well… that was easy. Thank you very much, Dylan.