Custom Meta

N2N-DL V3 offers a support for custom metadata to be associated with each LoRaWAN or Cellular device.

The customMeta object acts as key-value pair container where the value can be a string, boolean (true or false), a list of strings or a list of numbers like in the the following Typescript type definition:

customMeta: Record<string, string|number|boolean|string[]|number[]>;

Rationale

You can use the custom metadata field to add custom device and/or project related information that is useful to further differenciate a device once it’s installed in the field.

What follows is an example of custom metadata associated with a device:

{
  ...
    "enterpriseId": "nnn",
    "deviceType": "risingHf",
    "lastOnline": 1601002884890,
    "deviceId": "0000000001E014E7",
    "customMeta": {
        "serialNumber": "A6BB689C",
        "pcbNumber": "12345-1234",
        "build": "F03120"
    },
  ...
}

Custom meta and push subscriptions

The custom metadata is added to every message that is sent through push data subscriptions like in the example provided in the data subs page.

In order to keep the message payload small enough, attention should be paid to minimize the amount of custom meta fields associated with a device.

Searching by custom metadata

It’s possible to search all devices matching one or more specific metadata values like in the following example:

curl --location --request POST 'https://www.nnnco.io/v3/api/core/devices/search' \

--header 'Authorization: Basic ...' \

--header 'Content-Type: application/json' \

--data-raw '{
    "customMeta": {
        "serialNumber": "A6BB689C"
    }
}'

which returns a list of devices matching the specified search criteria:

[{
  "deviceId": "947EB90000100053",
  "name": "A6BB689C",
  "deviceType": "nsenMk2",
  "enterpriseId": "...",
  "lastOnline": 1601003499484,
  "customMeta": {
    "serialNumber": "A6BB689C",
    "pcbNumber": "12345-1234",
    "build": "F03120"
  },
  "lastDownlinkTs": 1600994411488,
  ...
}]

Swagger documentation

The documentation around searching and updating the custom metadata is part of the main Core V3 Open API Swagger documentation.

Limitations

You are currently limited to customMeta objects with maximum 50 keys but this is a soft limit that can be increased if necessary.