Backup and Restore Network session key

Viewed 7

Good morning,
We've recently been experiencing a reading issue with many heat metering devices.
They haven't been received since day X without any errors or gateway issues.
(We've already ruled out a gateway-related issue because it occurred on multiple systems and gateways. However, we've verified that the gateways are functioning correctly.)
(The devices experiencing this issue had already joined our lora network and are currently powered on and functioning.)
These devices lose their session keys after 30 days of not being received by any gateway registered on the network. Therefore, to receive them again, a new join will be necessary.
We'd like to know if it's possible (even via an API) to save the network session keys for a list of devices or an entire application, and if necessary, how to re-import them after resolving the reading issue.
Thank you for your support,
I remain available for further information.

Regards

1 Answers

Yes this can all be done via grpc or http rest api.

You will need to create a api key for the tenant if you just want tenant access or as admin if you want a key that works for everything.

run query to get all devices for an application, then using the returned device_eui for that application run api call to gather required keys for each device. or if you already know the device eui's already you can use them on the following endpoints.

GET: /api/applications <- all applications by tenant id (UUID)
GET: /api/devices <- all keys by application id (UUID)
GET: /api/devices/{devEui}/activation
GET: /api/devices/{devEui}/keys

Then to put them back in there is an api calls to...
POST: /api/devices/{deviceActivation.devEui}/activate
POST: /api/devices/{deviceKeys.devEui}/keys
or update just keys...
PUT: /api/devices/{deviceKeys.devEui}/keys