Data ingestion in Waylay IO

In the data ingestion tutorial, you will learn how to send data to an IoT cloud solution.

Saying that the Internet of Things evolved a lot in the last decade is a severe understatement. As a developer trying to get up to speed in this field, there are many obstacles to overcome and many moving parts that you have to understand and be proficient in.

Luckily, you do not have to start from scratch and you can build your knowledge on the shoulders of giants.

Any Internet of Things application will consist of at least two parts: a device and a cloud solution. The device will connect to the Internet (using WiFi, Ethernet, GPRS, or other special means) and the cloud will at the very least store the data gathered by the device or do other computation on top.

For both options, you have multiple alternatives and we can guarantee the rabbit hole is abyssal. What we propose is something that will get you results in a few minutes and will help you grasp the core concepts for future IoT projects.

The cloud solution we endorse is Waylay IO, a Low-Code platform designed for quick deployment. This translates into their developers handling integration with lots of third-party services, keeping your data safe, allowing you to do complex data computation, and alerting with visual programming.

And all for a very reasonably priced service. Even better, you can take it for a spin for a free month before making any major decisions.

Are you ready? We hope you are!

Steps

  • Create a Waylay IO account

Follow this sign up link and set up your account!

  • Create a resource on the cloud side to receive your data

From the main menu located on the left side of the platform, go to Resources and create a new one. A resource is an entity in the Waylay IO platform where you will send/store data from your device.

For now, you do not have to stress about the Resource type or the Identifier, which is already generated for you so just pick a name and create it.

Creating a resource on Waylay IO
Creating a resource on Waylay IO
  • Create a webscript

Go from the main menu to Webscripts and create a new one. This little code snippet will allow you to receive HTTP requests to receive data using the classic POST request.

The main thing you have to change before copy-pasting this in your field will be the id of the previously created resource in the 'paste_resource_id_here' placeholder:

Creating a webscript on Waylay IO
Creating a webscript on Waylay IO

Press Save once you have replaced the Resource ID.

  • Now let’s do a POST request.

These requests will be automatically done by devices in the future, but for now, to try things out, we suggest using a web tool on your laptop. This method will be a quick way of debugging or testing in the future as well.

There are quite a few tools capable of processing POST/GET requests available, from command-line tools such as cURL to browser extensions that you can simply add to your browser of choice to execute the POST request for you.

What we used was the RestMan Chrome extension since it has a friendly UX. For Firefox you could use RESTClient. All we have to do is fill in the following fields to try the request:

  • Select POST from the top left near the logo icon (initially there’s a GET there)
  • Go to Waylay IO and in the Webscripts menu click on the newly created webscript to copy the URL and paste it in the top area after the POST selector
  • Add a Header with Content-Type as Header and application/JSON as Value
  • Add a Body to your request (RAW, JSON) with some sample data like:
 {
"temperature": 23,
"humidity": 55
}

That's it, click the Airplane icon near the link to process the request.

Upon successful request you will get in the top area something resembling this:

Creating a POST request using RestMan
Creating a POST request using RestMan

Status 200 means the request was successfully received and processed and you should see your data on the Waylay IO platform.

A cURL sample for the setup above would be:

 curl -d '{"temperature":23,"humidity":55}' -H "Content-Type: application/json" -X POST https://webscripts-io.waylay.io/api/v1/resource_id/My_first_webscript?secret=secret_key

(be sure to replace the webscript with your actual URL that will contain the necessary secrets)

If you reached this point, Congrats! You have successfully emulated a device sending data to an IoT platform. Next stop - automating the world!

You can check the data reaching out the platform in the Resource you have created in the data tab:

Resource data on Waylay IO
Resource data on Waylay IO

What’s next?

We have a series of tutorials with other use cases that you could learn from and further sharpen your IoT skills or you could start your very own project.

If you need help in deploying this solution or building something similar please contact Waylay.io for the low-code IoT Solution or Zalmotek.com for IoT-enabled hardware prototypes.