Current#
API for getting and updating Current View displayed in the app window.
Get current view#
Get the current view.
- URL:
/api/current - Method:
GET
Success Response#
- Code:
200 OK - Content:
{ "id": "DEMO_0", "mode": "PUT", "edition": "full", "ts": 1578579862740, "version": "v1.2.0" }
Sample Call#
curl --request GET \
--url http://localhost:3000/api/current
Update current view#
Update the current view displayed in the app window. Either you provide an an view view ID as property id in the body, or you provide complete view data as property data. If both are provided, data is used.
- URL:
/api/current - Method:
POST - Body Props:
{ "data": "<VIEW_DATA>", "edition": "<EDITION>", "id": "<VIEW_ID>", "ts": "<TS>", "version": "<VERSION>" }
Success Response#
- Code:
200 OK - Content:
{ "id": "DEMO_0", "mode": "PUT", "edition": "full", "ts": 1578579862740, "version": "v1.2.0" }
Error Response example#
- Condition: If provided data is invalid, e.g. id does not exist.
- Code:
400 BAD REQUEST - Content:
{ "errors": ["View with id DEMO_7 not found"], "edition": "full", "ts": 1578581361767, "version": "v1.2.0" }
Sample Call with view ID#
curl --request PUT \
--url http://localhost:3000/api/current \
--header 'content-type: application/json' \
--data '{
"id": "DEMO_4",
"ts": 1554285937041,
"version": "v1.2.0"
}'
Sample Call with raw view data#
curl --request PUT \
--url http://localhost:3000/api/current \
--header 'content-type: application/json' \
--data '{
"data": {
"grid": {
"cols": 16,
"rowHeight": 36
},
"label": "DEMO Welcome",
"layout": [
{
"h": 6,
"i": "VSET543sK",
"w": 5,
"x": 2,
"y": 2
},
{
"h": 5,
"i": "ZsXLtfWo2",
"w": 10,
"x": 3,
"y": 18
},
{
"h": 2,
"i": "gCBjao-g9",
"w": 10,
"x": 3,
"y": 10
},
{
"h": 2,
"i": "imdeoTq3G",
"w": 10,
"x": 3,
"y": 13
}
],
"styles": {
"backgroundColor": "#212121",
"backgroundImage": "none",
"color": "#e0e0e0",
"fontFamily": "OpenSans",
"fontSize": 24,
"fontStyle": "inherit",
"fontWeight": 400
},
"widgets": [
{
"id": "VSET543sK",
"label": "disco Logo",
"styles": {
"& img": {
"borderColor": "transparent",
"borderRadius": "0",
"borderStyle": "none",
"borderWidth": "0",
"height": "100%",
"objectFit": "contain",
"objectPosition": "center",
"opacity": 1,
"visibility": "visible",
"width": "100%"
}
},
"wProps": {
"autoReload": false,
"reloadInterval": 20,
"source": "Static",
"switchInterval": 20,
"url": "https://disco-views.rockview.de/images/logo/disco_logo_480x240_transparent.png",
"urls": []
},
"wType": "Image"
},
{
"id": "imdeoTq3G",
"label": "Subtitle",
"styles": {
"& .widget__Box__inner": {
"alignItems": "center",
"backgroundColor": "transparent",
"backgroundImage": "none",
"borderColor": "transparent",
"borderRadius": "0",
"borderStyle": "none",
"borderWidth": "0",
"color": "currentColor",
"fontFamily": "inherit",
"fontSize": 56,
"fontStyle": "inherit",
"fontWeight": 600,
"justifyContent": "flex-start",
"lineHeight": "1.25",
"opacity": 1,
"padding": "0",
"visibility": "visible"
},
"padding": "0"
},
"wProps": {
"falseReplacer": "false",
"format": "HH:mm:ss",
"locale": "de",
"source": "Static",
"text": "Display and Control made simple",
"trueReplacer": "true",
"tz": "Europe/Berlin"
},
"wType": "Box",
"conditionalStyles": []
},
{
"id": "ZsXLtfWo2",
"label": "Info",
"styles": {
"& .widget__Box__inner": {
"alignItems": "flex-start",
"backgroundColor": "transparent",
"backgroundImage": "none",
"borderColor": "transparent",
"borderRadius": "0",
"borderStyle": "none",
"borderWidth": "0",
"color": "currentColor",
"fontFamily": "inherit",
"fontSize": 40,
"fontStyle": "inherit",
"fontWeight": 600,
"justifyContent": "flex-start",
"lineHeight": "1.25",
"opacity": 1,
"padding": "0",
"visibility": "visible"
},
"padding": "0"
},
"wProps": {
"falseReplacer": "false",
"format": "HH:mm:ss",
"locale": "de",
"source": "Static",
"text": "To get an idea what you can create with disco, point your browser to port 3000 of the host disco is running on. Go to the Views tab and start by editing the demo views.",
"trueReplacer": "true",
"tz": "Europe/Berlin"
},
"wType": "Box",
"conditionalStyles": []
},
{
"id": "gCBjao-g9",
"label": "Title",
"styles": {
"& .widget__Box__inner": {
"alignItems": "center",
"backgroundColor": "transparent",
"backgroundImage": "none",
"borderColor": "transparent",
"borderRadius": "0",
"borderStyle": "none",
"borderWidth": "0",
"color": "currentColor",
"fontFamily": "inherit",
"fontSize": 72,
"fontStyle": "inherit",
"fontWeight": 600,
"justifyContent": "flex-start",
"lineHeight": "1.0",
"opacity": 1,
"padding": "0",
"visibility": "visible"
},
"padding": "0"
},
"wProps": {
"falseReplacer": "false",
"format": "HH:mm:ss",
"locale": "de",
"source": "Static",
"text": "Welcome to disco!",
"trueReplacer": "true",
"tz": "Europe/Berlin"
},
"wType": "Box",
"conditionalStyles": []
}
],
"win": {
"fullscreen": false,
"kiosk": false,
"height": 768,
"width": 638,
"x": 0,
"y": 0
},
"params": []
},
"edition": "full",
"ts": 1554285937041,
"version": "v1.2.0"
}'
Last update: March 10, 2020