Get signal by zoneId
GET /signals/pid/:pid/zoneId/:zoneId
A signal can be fetched by zoneId by making a GET HTTP request.
A zone can be called in 3 different ways. To know more about the zones please read this understand zoneId
In all the cases the attribute to define the zone will be zoneId
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://q2.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"
curl "${HEADERS[@]}" -X GET $URL
var backendUrl = 'https://q2.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,
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);
}
});
backendUrl = 'https://q2.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, headers=headers)
# checking the response
if res_shadows.ok:
print "OK"
print res_shadows.text
else:
print "Error: " + res_shadows.text
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"
curl "${HEADERS[@]}" -X GET $URL
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,
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);
}
});
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, headers=headers)
# checking the response
if res_shadows.ok:
print "OK"
print res_shadows.text
else:
print "Error: " + res_shadows.text
Response
HTTP 200
{
"id": 392,
"name": "New Q app version available",
"message": "Q App version 3 is available. Download it at https://www.daskeyboard.io/get-started/download/",
"zoneId": "2,4",
"color": "#FF0000",
"effect": "SET_COLOR",
"pid": "DK5QPID",
"isArchived": false,
"isRead": false,
"isMuted": false,
"userId": 9,
"clientName": "Local Node script",
"createdAt": 1531946199392,
"updatedAt": 1531946199392
}