Files
EMS-ESP32/scripts/api_test.http
2023-12-25 13:27:02 +01:00

141 lines
2.3 KiB
HTTP
Executable File

# testing EMS-ESP API
# to be used with "REST Client" extension in Visual Studio Code (https://marketplace.visualstudio.com/items?itemName=humao.rest-client)
# Open this file in VSC, modify the token, go to the API call and click on 'Send Request' (or Ctrl+Alt+R)
# The response will be shown in the right panel
@host = http://ems-esp.local
@host_dev = http://10.10.10.135
@token = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWV9.2bHpWya2C7Q12WjNUBD6_7N3RCD7CMl-EGhyQVzFdDg
GET {{host}}/api/system/info
###
GET {{host}}/api/thermostat/seltemp
###
POST {{host}}/api/thermostat/seltemp
Content-Type: application/json
Authorization: Bearer {{token}}
{
"value" : 21.0
}
###
POST {{host}}/api/thermostat
Content-Type: application/json
Authorization: Bearer {{token}}
{
"entity" : "seltemp",
"value" : 21.0
}
###
POST {{host}}/api
Content-Type: application/json
Authorization: Bearer {{token}}
{
"device" : "boiler",
"entity" : "wwtapactivated",
"value" : "on"
}
###
GET {{host}}/api/system/restart
Authorization: Bearer {{token}}
###
GET {{host}}/api/boiler/coldshot
Authorization: Bearer {{token}}
###
GET {{host}}/api/temperaturesensor/info
###
#
# Test on dev
#
GET {{host_dev}}/rest/features
###
GET {{host_dev}}/api/system/info
# Run a test. EMS-ESP must be compiled with -DEMSESP_TEST
# Use this to load up a dummy thermostat and boiler with data
###
GET {{host_dev}}/api?device=system&cmd=test&data=general
###
GET {{host_dev}}/api/boiler/info
###
GET {{host_dev}}/api/boiler/values
###
GET {{host_dev}}/api/analogsensor/info
###
GET {{host_dev}}/api/boiler/coldshot
Authorization: Bearer {{token}}
###
GET {{host_dev}}/api/system/commands
###
GET {{host_dev}}/rest/getSettings
Authorization: Bearer {{token}}
###
POST {{host_dev}}/rest/signIn
Content-Type: application/json
###
GET {{host_dev}}/rest/coreData
Authorization: Bearer {{token}}
###
GET {{host_dev}}/rest/logSettings
###
GET {{host_dev}}/rest/systemStatus
Authorization: Bearer {{token}}
###
GET {{host_dev}}/rest/deviceData?id=1
Authorization: Bearer {{token}}
###
GET {{host_dev}}/rest/networkSettings
Authorization: Bearer {{token}}
# test using CLI with:
curl -X POST http://10.10.10.135/rest/signIn \
-H 'Content-Type: application/json' \
-d '{ "value" : 22 }'