GET
- /
Response:
Example - https://esp32-rest-server.herokuapp.com/
{
"device": [
{
"_id": "6259c59093e95817659fb32e",
"name": "Device 1",
"data": 55.45,
"status": false
},
{
"_id": "6259c63293e95817659fb32f",
"name": "Device 2",
"data": 89.36,
"status": true
},
{
"_id": "6259c64e93e95817659fb330",
"name": "Device 3",
"data": 142.58,
"status": false
},
{
"_id": "625a71f6700eb08a3c0538b0",
"name": "Device 4",
"data": 55,
"status": true
},
{
"_id": "625a765051245dd4ca5daf79",
"name": "Device 5",
"data": 78,
"status": true
},
{
"_id": "625a79154745a1d0a19365ef",
"name": "Device 6",
"data": 19,
"status": true
}
]
}
GET
- /device/<id>
Response:
Example - https://esp32-rest-server.herokuapp.com/device/6259c59093e95817659fb32e
{
"device": {
"_id": "6259c59093e95817659fb32e",
"name": "Device 1",
"data": 55.45,
"status": false
}
}
GET
- /device/name/<name>
Response:
Example - https://esp32-rest-server.herokuapp.com/device/name/Device 1
{
"device": {
"_id": "6259c59093e95817659fb32e",
"name": "Device 1",
"data": 55.45,
"status": false
}
}
POST
- /device/new
Body:
{
"newdevice" :
{
"name" : "Device 6",
"data" : 18.93,
"status" : true
}
}
Response:
{
"message": "Device Created"
}
PUT
- /device/update/<id>
Body:
{
"deviceData":{
"data" : 87.45
}
}
DELETE
- /device/delete/<id>
Response:
{
"message": "Device Deleted 🔪"
}
DELETE
- /device/delete/name/<name>
Response:
{
"message": "Device Deleted 🔪"
}