Simple REST API that manages IoT sensors, sensor groups and measurements.
- Install Git
- Clone repository from sensoan.visualstudio.com - Code - iaq-rest-api
- Install node from https://nodejs.org
- Run npm install
- Run node app
- Development version of the api is listening port 3000
- Api can be used from any web browser or application.
- Get commands can be executed from the browser: type in the URL box (e.g.): http://localhost:3000/v1/groups
- Other commands can be executed for example with Postman (https://www.getpostman.com)
- Setup the database first: GET /v1/setupDatabase
- Get all groups: GET /v1/groups
- Get one group by mongoDB ID: GET /v1/groups/document/
- Get one group by group name: GET /v1/groups/document/
- Update existing group: PUT /v1/groups, documentID in the request body
- Add new group: POST /v1/groups, response: documentID, group name must be unique
- Delete group: DELETE /v1/groups/, group can be removed only if it does not have any sensors
- Get all sensors: GET /v1/sensors
- Get one sensor by sensorID: GET /v1/sensors/
- Get all sensors by group name: GET /v1/sensors/group/
- Get the document for mongoDB ID: GET /v1/sensors/document/
- Update existing sensor: POST /v1/sensors, sensorID in the request body
- Add new sensor: POST /v1/sensors/new, response: sensorID
- Delete sensor: DELETE /v1/sensors/, sensor can be removed only if it does not have any measurements
- Get all measurements: GET /v1/measurements
- Get all measurents that are equal or newer than date1: GET /v1/measurements?date1=, date format: YYYY-MM-DD, result sorted by timestamp in ascending order
- Get all measurements that are between date1 and date2: GET /v1/measurements/?date1=&date2= date format: YYYY-MM-DD, result sorted by timestamp in ascending order
- Get measurements for the sensor ID: GET /v1/measurements/sensor/, result sorted by timestamp in ascending order
- Get measurements for the sensor ID that are equal or newer than date1: GET /v1/measurements/sensor//?date1=
- Get measurements for the sensor ID that between date1 and date2: GET /v1/measurements/sensor//?date1=&date2=
- Get the latest measurement for the sensor ID: GET /v1/measurements/sensor/latest/
- Get the document for mongoDB ID: GET /v1/measurements/document/
- Delete measurement: DELETE /v1/measuements/document/
- Add new measurement: POST /v1/measurements