This page contains detailed information about the CoAP service in the Tartabit IoT Bridge. This service allows you to send and receive CoAP requests for easy integration with other systems and services.
POST, GET, PUT, DELETE, FETCH, PATCH, IFETCHThe CoAP Connector is used by both the CoAP client actions and server events. For servers, the service contains the webhook secret used to authenticate and route the incoming CoAP request. For clients, the service is used an an anchor for metering and additional functionality will be added in the future.
Endpoint key field must be set to a number from 0-n representing which element of the path in the request contains the endpoint identifier. For example if your device sends data with a path of /uplink/112233445566/data the path segment would be 1.Endpoint key field must be set to a string that represents which query variable contains the endpoint identifier.Endpoint key type and allows defining which field is used to extract the endpoint key.dateLastStatusDetail with the timestamp of the last received message.dateLastStatusDetail with the timestamp of the last received message, and touch the last activity for the endpoint maintaining its connected status.dateLastStatusDetail with the timestamp of the last received message, and generate a coap-keepalive event that can be processed in a trigger.This event fires when a CoAP message is received by the server.
{
"method": "put",
"path": "wh/mysecret/myendpoint",
"pathSegments": [ "wh", "mysecret", "myendpoint" ],
"query": {
"key": "value"
},
"body":{
"key1":"abc",
"key2":456
}
}
register or deregister to indicate that an observation has been created or removed.This event fires when a CoAP keep-alive message is received from a device.
{
"remoteAddress": "10.132.0.15:39252"
}
This event can be replied to to return data back to the client, for example:
// returns Content (69 in coap, equivelant of 200 in HTTP, and body data),
trigger.reply({status:'2.00', body:'myreturndata'})
If you do not reply to a request, the server will respond with an Internal Server Error to the client.
The reply object has the following data:
octets, json, or textSend a CoAP packet and wait for a reply from the device, the type will default to confirmable unless overriden in the options.
// Issue a get to a device
var reply = coap.send('coap-svc', 'get', '10.220.31.12:5683', '/read')
// Issue a post to a device
var reply = coap.send('coap-svc', 'post', '10.220.31.12:5683', '/write', 'AT+RPT=300')
get, post, put, or delete.con, noncon, ack, or reset to set the type of the CoAP packet.octets, json, text to set the contentFormat for the packet.register or deregister to set the observe flag in the request.Send a CoAP notification to an existing observation and wait for a response, the type will default to confirmable unless overriden in the options.
// Issue a get to a device
var reply = coap.notify('coap-svc', '2.05', '10.220.31.12:5683', '0001')
2.01 or any other valid response code.con, noncon, ack, or reset to set the type of the CoAP packet.octets, json, text to set the contentFormat for the packet.The following events are considered billable:
While you can modify the webhook secret, keep in mind that it is a secret, and choosing a secret that is not cryptographically secure can result in unauthorized use of your account.