Skip to content

Files

Latest commit

c17e237 · Mar 14, 2017

History

History
This branch is up to date with lucj/IoT-demo-project:master.

step1

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 12, 2017
Mar 14, 2017
Mar 12, 2017

Objectives

Setting up a basic HTTP API that collects time series data sent in JSON. The format of the input data is the following one:

{
  ts: TIMESTAMP
  type: TYPE_OF_DATA
  value: VALUE,
  sensor_id: ID_OF_THE_DEVICE_SENDING_THE_DATA
}

Example of a valid input data:

{
  ts: "2017-03-01T23:12:52Z",
  type: "temp",
  value: 34,
  sensor_id: 123
}

The API

In order to create this application you can choose the language you want based on your preferences. In the current version Node.js will be used as an example.

This first (and very simple) version of the API needs to

  • implement a HTTP Post endpoint on /data
  • listen on port 1337 unless the PORT environment variable is provided
  • reply with a 201 HTTP Status Code (creation)
  • displays the received data on the standard output
  • add a simple test to check the implementation (the test should send the data example defined above)

Implementation's example

You are invited to develop your own implementation. Otherwise, you can also copy, at the root of your iot-api folder, the content of the nodejs folder (Node.js example implementation) if you want to.

Node.js

Note: implementation examples in other languages will be provided soon.


< Previous - Next >