Securing your online data

dweet.io secures your data through a method known as locking. Locks keep your data secure by preventing access, unless a thing or a person provides a special key. In this recipe, we will look at how to set up a lock and some features that come with it. This way you will know how to secure the data you post online from your ESP8266.

Locking your things

When you lock your thing, its name cannot be used by another person. You can acquire and maintain a lock by paying a small fee of $1.99 every month. Once you pay, you are provided with a lock and a special key. Using the lock and key, you can secure your things and prevent other people/things from accessing your data on dweet.io.

When you pay for a lock, you receive your lock ID and a unique key in your e-mail account. You can then lock your things through the web API by calling this URL:

https://dweet.io/lock/{thing_name}?lock={your_lock}&key={your_key}

If your thing is locked successfully, you will receive this reply:

{"this":"succeeded","by":"locking","the":"garden-monitor-11447","with":"lock"}

You can also use the https://dweet.io/locks webpage to lock your things. All you need to do is provide the name of your thing, your lock, and the special key. The form looks like this:

Locking your things

Once your thing is locked, you will only be able to access it using the unique key. To do that, just add a parameter called key to the API call you are making. For instance:

https://dweet.io/dweet/for/{my_locked_thing}?key={my_key}&hello=world&foo=bar

https://dweet.io/get/dweets/for/{my_locked_thing}?key={my_key}

https://dweet.io/get/latest/dweet/for/{my_locked_thing}?key={my_key}

https://dweet.io/listen/for/dweets/from/{my_locked_thing}?key={my_key}

You can unlock your thing using this URL: https://dweet.io/unlock/{thing_name}?key={your_key}, or remove the lock completely regardless of what things it is connected to using this URL: https://dweet.io/remove/lock/{your_lock}?key={your_key}

In addition to data security, there are several other benefits that come with acquiring a lock. For instance, you get a 30-day storage period for every locked dweet, as opposed to the 24-hour storage period that is available for unlocked dweets. You can also access all data that was posted within a specific hour of any day in the 30-day period. This allows you more control over how you are going to monitor your processes. You can do that using this URL: https://dweet.io/get/stored/dweets/for/{thing}?key={key}&date={date}&hour={hour}&responseType={type},

Where:

  • {thing}: This is a valid name for your thing.
  • {key}: This is the valid key for your locked dweet.
  • {date}: This is the calendar date (YYYY-MM-DD) of the day you want to query data from.
  • {hour}: This is the hour of the day that you want to start querying the data from. It is in the 24-hour format. Data that was published within one hour of the specified time will be returned.
  • {type}: This can either be json or csv. If left it blank, the type will, by default be json. csv only works with dweets that have a static data model.

An example of a URL in that format is:

https://dweet.io/get/stored/dweets/for/my_thing?key=abc123&date=2016-01-31&hour=13&responseType=csv

You can add alerts to locked dweets. The alerts let you know when a certain condition has been met by the data that is being posted on dweet.io. To set alerts, you use the following URL:

https://dweet.io/alert/{recipients}/when/{thing}/{condition}?key={key}

You can remove alerts using this URL format:

https://dweet.io/remove/alert/for/{thing}?key={key}

Another feature that is not specifically accessible to locked dweets is real-time streams. By making a call to this URL: https://dweet.io/listen/for/dweets/from/{my-thing-name}, you will be able to receive dweets as they arrive.

There are different ways of ensuring that data stored on online servers is secure. The methods available to you will be determined by the online IoT platform you use. Therefore, find out whether your platform provides data security before you start using it.

See also

To employ better data presentation for monitoring trends, you need graphs and pie charts. You won't be able to access any of that on your ESP8266 board, but you can use cloud dashboards to do it. Our next recipe will show you how to go about it.

There are also other cloud storage services you can check out that would work with the ESP8266, such as ThingSpeak.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.95.38