# CoAP receiver

This receiver allows clients to send data to the Lynx server using the CoAP protocol. This is not always enabled.

# Authentication

The CoAP option number 70 is used to authenticate the calling user. The API-Key used in this field will be used in the forwarded call to Lynx.

# Responses

The normal CoAP response codes are used where matching from a known HTTP status code can be done.

For example: the HTTP Status code 401 will be translated to the CoAP code 4.01.

If successful the response will be the same as using the HTTP endpoint for sending MQTT.

# Example

Create a file named data.json with JSON content as it would be formatted on the HTTP endpoint for MQTT:

{
  "topic": "obj/example/1/temperature",
  "payload": {
    "value": 27.0,
    "msg": "hello",
    "timestamp": 1682432807
  }
}

Send the data file using coap-client replacing <API-Key> with an API-Key from the Lynx platform and the <installation_id> with the ID of the installation.

coap-client -w -G 1 -m 'POST' -f data.json -O 70,<API-Key> coap://lynx.iotopen.se/publish/<installation_id>