Draw on display
1 min
code examples curl request post \\ \ url /api/display/draw \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "application name" "my app", "priority" 50, "elements" { "id" "", "type" "", "display" "front", "timestamp" "", "color" "#ffffffff", "direction" "", "show hours" "" } }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "application name" "my app", "priority" 50, "elements" { "id" "", "type" "", "display" "front", "timestamp" "", "color" "#ffffffff", "direction" "", "show hours" "" } }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("/api/display/draw", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("/api/display/draw") http = net http new(url host, url port); request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "application name" "my app", "priority" 50, "elements" { "id" "", "type" "", "display" "front", "timestamp" "", "color" "#ffffffff", "direction" "", "show hours" "" } }) response = http request(request) puts response read body import requests import json url = "/api/display/draw" payload = json dumps({ "application name" "my app", "priority" 50, "elements" { "id" "", "type" "", "display" "front", "timestamp" "", "color" "#ffffffff", "direction" "", "show hours" "" } }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses // drawing command executed successfully { "result" "ok" }// invalid drawing data { "error" "", "code" 0 }// requested priority level is below that of currently active app { "error" "", "code" 0 }// failed to load canvas app { "error" "", "code" 0 }
