Get signal color by zoneId

GET /signals/pid/:pid/zoneId/:zoneId/color

A signal color can be fetched by zoneId by making a GET HTTP request. If there is no signal in the zone. The endpoint will return #000000

Request parameters

Parameter Description
zoneId Required string 'KEY_Q' '74' '2,2'

Specify the id of the zone triggered

pid Required string 'DK5QPID'

Pid of the device triggered

Request

BACKEND_URL="https://q.daskeyboard.com"

HEADERS=(-H "X-API-KEY: $API_KEY" -H "Content-Type: application/json")
PID="DK5QPID"
ZONE_ID="2,4"
URL="$BACKEND_URL/api/1.0/signals/pid/$PID/zoneId/$ZONE_ID/color"

curl "${HEADERS[@]}" -X GET $URL

 Copy

 Edit Script

var backendUrl = 'https://q.daskeyboard.com';
var headers = {
    "Content-Type": "application/json",
    "X-API-KEY": "$API_KEY"
  }
// Library to make simplified HTTP client requests
// if not installed run npm install request
var request = require('request');

var pid = 'DK5QPID';
var zoneId = '2,4';

request.get({
    url: backendUrl + '/api/1.0/signals/pid/' + pid + '/zoneId/' + zoneId + '/color',
    headers: headers,
    json: true
}, function (error, response) {
    // OK
    if (response && response.statusCode == 200) {
        console.log('response', response.body);
    }
        // OK from API response
    if(response && response.statusCode != 200){
        console.error(response.body);
    }
    // OK
    if (error) {
        console.error(error);
    }
});

 Copy

 Edit Script


backendUrl = 'https://q.daskeyboard.com'

headers = { "Content-type": "application/json","X-API-KEY": "uS3qbfUi5sFNq2GU1j7EaAQkgdft0Zwg"}
import json
# sudo pip install request
import requests



pid = 'DK5QPID'
zone_id = '2,4'
res_shadows = requests.get(backendUrl + '/api/1.0/signals' + '/pid/'+ pid + '/zoneId/' 
+ zone_id + '/color', headers=headers)

# checking the response
if res_shadows.ok:
    print "OK"
    print res_shadows.text
else:
    print "Error: " + res_shadows.text

 Copy

 Edit Script

BACKEND_URL="http://localhost:27301"
HEADERS=(-H "Content-Type: application/json")
PID="DK5QPID"
ZONE_ID="2,4"
URL="$BACKEND_URL/api/1.0/signals/pid/$PID/zoneId/$ZONE_ID/color"

curl "${HEADERS[@]}" -X GET $URL

 Copy

 Edit Script

var backendUrl = 'http://localhost:27301';
var headers = {
    "Content-Type": "application/json"
  }
// Library to make simplified HTTP client requests
// if not installed run npm install request
var request = require('request');

var pid = 'DK5QPID';
var zoneId = '2,4';

request.get({
    url: backendUrl + '/api/1.0/signals/pid/' + pid + '/zoneId/' + zoneId + '/color',
    headers: headers,
    json: true
}, function (error, response) {
    // OK
    if (response && response.statusCode == 200) {
        console.log('response', response.body);
    }
        // OK from API response
    if(response && response.statusCode != 200){
        console.error(response.body);
    }
    // OK
    if (error) {
        console.error(error);
    }
});

 Copy

 Edit Script

backendUrl = 'http://localhost:27301'
headers = { "Content-type": "application/json"}
import json
# sudo pip install request
import requests



pid = 'DK5QPID'
zone_id = '2,4'
res_shadows = requests.get(backendUrl + '/api/1.0/signals' + '/pid/'+ pid + '/zoneId/' 
+ zone_id + '/color', headers=headers)

# checking the response
if res_shadows.ok:
    print "OK"
    print res_shadows.text
else:
    print "Error: " + res_shadows.text

 Copy

 Edit Script

Response
HTTP 200
#FF0000