Network API Documentation - OverFlowJAMK/General GitHub Wiki

(*) Address where API can be found

GET devices

Returns mac-addresses of measuring devices which is currently allowed in network

Resource url

http://*/network/api/v0.1/devices

Resource information

Response format JSON
Requires authentication? Not yet
Rate limited? No

Example response

{"devices": [{"device": "00:00:00:00:00:01"}, {"device": "00:00:00:00:00:02"}]}

GET device

Returns boolean value is device allowed in network

Resource url

http://*/network/api/v0.1/device

Resource information

Input format JSON
Response format JSON
Requires authentication? Not yet
Rate limited? No

Parameters

device MAC-address of the device required

Example response

{"device allowed": "true"}

POST device

Allows new device in network

Resource url

http://*/network/api/v0.1/device

Resource information

Input format JSON
Response format JSON
Requires authentication? Not yet
Rate limited? No

Parameters

device MAC-address of the device required

Example response

{"result": [{"success": "true"}]}

DELETE device

Removes device from network

Resource url

http://*/network/api/v0.1/device

Resource information

Input format JSON
Response format JSON
Requires authentication? Not yet
Rate limited? No

Parameters

device MAC-address of the device required

Example response

{"result": [{"success": "true"}]}

Example tests by using curl

  • curl -H "Content-Type: application/json" -X GET 127.0.0.1:5000/network/api/v0.1/devices -v
  • curl -H "Content-Type: application/json" -X GET 127.0.0.1:5000/network/api/v0.1/device -d '{"device":"00:00:00:00:00:01"}' -v
  • curl -H "Content-Type: application/json" -X POST 127.0.0.1:5000/network/api/v0.1/device -d '{"device":"00:00:00:00:00:01"}' -v
  • curl -H "Content-Type: application/json" -X DELETE 127.0.0.1:5000/network/api/v0.1/device -d '{"device":"00:00:00:00:00:01"}' -v