I am trying to update a Gateway using the REST Api to Configure CUPS to send the LNS API Key. The steps to do this manually are documented here:
https://www.thethingsindustries.com/docs/gateways/concepts/lora-basics-station/cups/
For quick reference, this is the area on the Console I am trying to set via the Api.
The update Gateway Put endpoint is described here:
https://www.thethingsindustries.com/docs/api/reference/http/routes/#GatewayRegistry
For quick reference here is the schema for the property in question:
"lbs_lns_secret": {
"description": "Secret contains a secret value. It also contains the ID of the Encryption key used to encrypt it.",
"properties": {
"key_id": {
"description": "ID of the Key used to encrypt the secret.",
"type": "string"
},
"value": {
"format": "byte",
"type": "string"
}
},
"type": "object"
},
The Key format is described here:
The Key format is describe here: Authentication | The Things Stack for LoRaWAN
NNSXS.U4H3ZFFCMSR42BUAZPW2UWGFBV4WCNI5EXDJXDY.SHIF3PP5PBMJNZESN5XLR5TZJTJUIGKVUTM2I22IVBUVCD6VIQIA
Token-id = `U4H3ZFFCMSR42BUAZPW2UWGFBV4WCNI5EXDJXDY`
Token-secret = `SHIF3PP5PBMJNZESN5XLR5TZJTJUIGKVUTM2I22IVBUVCD6VIQIA`
When send my update by JSON body is:
`So when I send my update by Json Body is:
{
"field_mask": "lbs_lns_secret",
"gateway": {
"lbs_lns_secret": {
"key_id": "U4H3ZFFCMSR42BUAZPW2UWGFBV4WCNI5EXDJXDY",
"value": "SHIF3PP5PBMJNZESN5XLR5TZJTJUIGKVUTM2I22IVBUVCD6VIQIA"
}
}
}
The response I get back is:
{
"ids": {
"gateway_id": "eui-test-xxxxyyyyzzzz123",
"eui": " eui-test-xxxxyyyyzzzz123"
},
"created_at": "2024-06-27T19:01:16.388457Z",
"updated_at": "2024-06-27T21:51:09.644234Z",
"lbs_lns_secret": {
"key_id": "is/gateway-secrets-encryption-key",
"value": " SHIF3PP5PBMJNZESN5XLR5TZJTJUIGKVUTM2I22IVBUVCD6VIQIA "
}
}
So it looks like everyone works until I check the console.
I’m not sure what I’m doing wrong. Has anyone else done this?
The schema indicates it’s a byte string, I’m not sure if I’m not formatting it right? I tried stuff like base64 decoding and converting to a byte-string, but that didn’t help. I’m hoping someone can save me from this game of guess and check!