Parameters#
API for getting, applying Actions to Parameters and updating Parameter Values.
Get all Parameters#
- URL:
/api/params - Method:
GET - Query Params:
- Optional
globalonly=1: Returns only GlobalParameters
Success Response#
- Code:
200 OK - Content:
{ "data": { "sC7L86ho": { "access": "rw", "id": "sC7L86ho", "isGlobal": true, "label": "BOOL_0", "props": { "defaultVal": false }, "type": "Boolean", "val": true, "source": "API" }, "CURRENT": { "access": "rw", "id": "CURRENT", "label": "CURRENT", "props": { "defaultIndex": 1, "items": [ "DATA", "DEMO Welcome", "DEMO Newsroom", "DEMO Traffic", "DEMO Webcams", "DEMO Button", "TcSlider" ] }, "type": "Selector", "index": 1, "val": "DEMO Welcome", "isGlobal": true, "source": "hedgehog" } }, "edition": "full", "ts": 1581418754326, "version": "v1.2.0" }
Sample Call#
curl --request GET \
--url 'http://localhost:3000/api/params'
Get Parameter by ID#
- URL:
/api/params/:id - Method:
GET
Success Response#
- Code:
200 OK - Content:
{ "data": { "id": "CURRENT", "label": "CURRENT", "props": { "defaultIndex": 1, "items": [ "DATA", "DEMO Welcome", "DEMO Newsroom", "DEMO Traffic", "DEMO Webcams", "DEMO Button" ] }, "type": "Selector", "index": 1, "val": "DEMO Welcome", "access": "rw", "isGlobal": true, "source": "hedgehog" }, "edition": "full", "ts": 1579171224264, "version": "v1.2.0" }
Error Response example#
- Condition: If provided data is invalid, e.g. id does not exist.
- Code:
404 NOT FOUND - Content:
{ "errors": ["Parameter with id UNKNOWN not found"], "edition": "full", "ts": 1579171275688, "version": "v1.2.0" }
Sample Call#
curl --request GET \
--url http://localhost:3000/api/params/CURRENT
Apply Action to Parameter#
- URL:
/api/params/:id - Method:
GET - Query Params:
- Optional
globalonly=1: Returns only GlobalParameters
Success Response#
- Code:
200 OK - Content:
{ "id": "sC7L86ho", "type": "BOOLEAN_TOGGLE", "edition": "full", "ts": 1581418739622, "version": "v1.2.0" }
Error Response Example#
- Condition: If provided data is invalid, e.g. parameter id is unknown.
- Code:
404 NOT FOUND - Content:
{ "errors": [ "Parameter with id UNKNOWN not found" ], "edition": "full", "ts": 1581418874305, "version": "v1.2.0" }
Sample Call#
curl --request POST \
--url http://192.168.178.20:3000/api/params/sC7L86ho \
--header 'content-type: application/json' \
--data '{
"type": "BOOLEAN_TOGGLE",
"version": "1.2.0"
}'
Update Parameter Value#
- URL:
/api/params/:id - Method:
GET - Query Params:
- Optional
globalonly=1: Returns only GlobalParameters
Success Response#
- Code:
200 OK - Content:
{ "data": { "id": "sC7L86ho", "val": true }, "edition": "full", "ts": 1581419206767, "version": "v1.2.0" }
Error Response Example#
- Condition: If provided data is invalid, e.g. parameter id is unknown.
- Code:
404 NOT FOUND - Content:
{ "errors": [ "Parameter with id UNKNOWN not found" ], "edition": "full", "ts": 1581419229331, "version": "v1.2.0" }
Sample Call#
curl --request PUT \
--url http://localhost:3000/api/params/sC7L86ho \
--header 'content-type: application/json' \
--data '{
"val": true,
"version": "1.2.0"
}'
Last update: March 10, 2020