measurment_api

Authentication 4

Routes for user authentication including register, login, reset password, etc

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

AuthorizationBearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxNWVlZDEyZDg5ZDQzYjU2YTk0MGI3ZiIsImlhdCI6MTYzMzYxMTAyNn0.3gZgZJPJ1M3MJncWtxCC7ropeVZpL-1MEEcDroK2wMQ
Query
KeyValueDescription
Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "email": "john@gmail.com", "password": "123456" }
Description

Add user to database wit encrypted password

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "name": "Brad Traversy", "email": "brad@gmail.com", "password": "123456", "role": "publisher" }

Commands 6

Manage remote commands

Headers
KeyValueDescription
Content-Typeapplication/json
Body
{ "device_name": "md-gb-stuw-001", "remote_command": "b", "timestamp": 1637267989, "user": "marcbeltman@hotmail.com" }
Description

Get all commands from database

example get latest command {{URL}}/api/v1/Commands?sort=-timestamp&limit=1

Description

get the last given command stored in the database by filtering on “device_name” and “timestamp”

Query
KeyValueDescription
device_namemd-gb-stuw-001
sort-timestamp
limit1
Description

update existing command by id

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "device_name": "fucksel-ducksel", "remote_command": "c" }

Measurments 5

measurments CRUD functionality

Description

Add new measurment to database. Must be authenticated and must be publisher or admin

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "device_name": "md-gb-md0001", "location": "soerbeek", "distance_watersurface": 150, "waterlevel": 25, "waterlevel_difference": 3, "waterlevel_modified": false, "taw": 3044, "timestamp": 1633219200, "buck_status": true, "boost_status": true, "charging": false, "battery_percentage": 56, "solar_voltage": 3.3, "power_enable": true, "gpy_enable": false, "charge_required": true, "charge_done": false }
Description

Fetch all measurments from the database. Includes pagination, filtering, sorting and selecting

Example “Selecting”: (get selected fields) /api/v1/measurments?select=device,timestamp,waterlevel

Example “Filtering”: (filter timestamps between a starttime and endtime) /api/v1/measurments?timestamp[gt]=1633219200&timestamp[lt]=1633737600

Example “Sorting”: (sort field in numerical order) /api/v1/measurments?sort=name

Example “Combination select and filter”: /api/v1/measurments?select=device,timestamp,waterlevel&timestamp[gt]=1633219200&timestamp[lt]=1633737600

Description

Update single measurment in database

Users 5

CRUD functionality for users only available to admins

Description

Add user to database (admin)

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "name": "marc beltman", "email": "marcbeltman@hotmail.com", "password": "123456" }
Description

Delete user from the database (admin)

Description

Get all users (admin)

Description

Update user in database (admin)

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "name": "henk vis", "email": "henk@hotmail.com", "password": "123456" }