HTTP Payload JSON config templates
Reads in json format
[{
"event":"TAG_READ",
"path":"'/to/my/url'",
"body":"
var body='{';
body+='\"devid\": \"'+ctx_devid+'\",';
body+='\"devip\": \"'+ctx_devip+'\",';
body+='\"devmac\": \"'+ctx_devmac+'\",';
body+='\"reads\": [';
for(i=0;i<ctx_tags.length;i++)
{
body+='{';
body+='\"epc\": \"'+ctx_tags[i].getEPC()+'\",';
body+='\"sku\": \"'+ctx_tags[i].getSKU()+'\",';
body+='\"serial\": \"'+ctx_tags[i].getSerial()+'\",';
body+='\"tid\": \"'+ctx_tags[i].getTID()+'\",';
body+='\"phase\": \"'+ctx_tags[i].getPhase()+'\",';
body+='\"antenna\": \"'+ctx_tags[i].getAntenna()+'\",';
body+='\"mux1\": \"'+ctx_tags[i].getMux1()+'\",';
body+='\"mux2\": \"'+ctx_tags[i].getMux2()+'\",';
body+='\"uri\": \"'+ctx_tags[i].getURI()+'\",';
body+='\"rssi\": \"'+ctx_tags[i].getRSSI()+'\",';
body+='\"ts\": \"'+ctx_tags[i].getUTC()+'\"';
body+='}';
if(i< ctx_tags.length - 1){
body+=',';
}
}
body+=']';
body+='}';
"
}]
output
{
"devid": "AdvanSafe-200-eu",
"devip": "192.168.1.15",
"devmac": "b0:d5:cc:9f:fd:f8",
"reads": [
{
"epc": "303602dd0000000000000125",
"sku": "08435520000001",
"serial": "293",
"tid": "",
"antenna": "2",
"mux1": "3",
"mux2": "0",
"uri": "urn:epc:tag:sgtin-96:1.8435520.000000.293",
"rssi": "-74",
"ts": "1618401088293"
},
{
"epc": "303602dd0000000000000189",
"sku": "08435520000001",
"serial": "393",
"tid": "",
"antenna": "2",
"mux1": "4",
"mux2": "0",
"uri": "urn:epc:tag:sgtin-96:1.8435520.000000.393",
"rssi": "-74",
"ts": "1618401088387"
}
]
}
Alarms in json format
[{
"event":"TAG_ALARM",
"path":"'/path/to/my/resource/1'",
"body":"
var body='{';
body+='\"type\": \"'+ctx_type+'\",';
body+='\"devid\": \"'+ctx_devid+'\",';
body+='\"devip\": \"'+ctx_devip+'\",';
body+='\"devmac\": \"'+ctx_devmac+'\",';
body+='\"epc\": \"'+ctx_epc+'\",';
body+='\"sku\": \"'+ctx_sku+'\",';
body+='\"serial\": \"'+ctx_serial+'\",';
body+='\"uri\": \"'+ctx_uri+'\"';
body+='}';
"
}]
output
{
"type": "TAG_ALARM",
"devid": "AdvanSafe-200-eu",
"devip": "192.168.1.15",
"devmac": "b0:d5:cc:9f:fd:f8",
"epc": "303602c25c23568874512254",
"sku": "08433815361868",
"serial": "36311212628",
"uri": "urn:epc:tag:sgtin-96:1.8433815.036186.36311212628"
}
Status report messages in json format
[{
"event":"SYSTEM_1MINUTE_TIMER",
"path":"'/path/to/my/resource/1'",
"body":"
var body='{';
body+='\"type\": \"'+ctx_type+'\",';
body+='\"devid\": \"'+ctx_devid+'\",';
body+='\"devip\": \"'+ctx_devip+'\",';
body+='\"devmac\": \"'+ctx_devmac+'\",';
body+='\"devstatus\": \"'+ctx_devstatus+'\",';
body+='\"alarms\": '+ctx_alarms;
body+='}';
"
}]
output
{
"type": "SYSTEM_1MINUTE_TIMER",
"devid": "AdvanSafe-200-eu",
"devip": "192.168.1.15",
"devmac": "b0:d5:cc:9f:fd:f8",
"devstatus": "ALIVE",
"alarms": []
}
GPI triggered in json format
[{
"event":"GPI",
"path":"'/path/to/my/resource/1'",
"body":"
var body='{';
body+='\"type\": \"'+ctx_type+'\",';
body+='\"line\": \"'+ctx_subtype.split(\" \")[1]+'\",';
body+='\"trigger\": \"'+ctx_subtype.split(\" \")[0]+'\",';
body+='\"devid\": \"'+ctx_devid+'\",';
body+='\"devip\": \"'+ctx_devip+'\",';
body+='\"devmac\": \"'+ctx_devmac+'\"';
body+='}';
"
}]
output
{
"type": "GPI",
"line": "3",
"trigger": "HIGH_TO_LOW",
"devid": "AdvanSafe-200-eu",
"devip": "192.168.1.15",
"devmac": "b0:d5:cc:9f:fd:f8"
}
{
"type": "GPI",
"line": "3",
"trigger": "LOW_TO_HIGH",
"devid": "AdvanSafe-200-eu",
"devip": "192.168.1.15",
"devmac": "b0:d5:cc:9f:fd:f8"
}