Hey everyone!
We're making use of nRFCloud on our nRF9160-based system.
I'm trying to populate the meta in the location history API.
The response is always empty, like this:
Hey everyone!
We're making use of nRFCloud on our nRF9160-based system.
I'm trying to populate the meta in the location history API.
The response is always empty, like this:
Hi,
The issue is with the formatting of the message data. Put the "bat" property inline like this:
{ "topic": "prod/XX/XX", "deviceId": "nrf-XX", "receivedAt": "2022-12-06T09:27:13.804Z", "message": { "messageType": "DATA", "data": { "acc": 24.000000, "lng": 17.000000, "lat": 68.000000, "bat": 4167 } "appId": "GNSS" }, "tenantId": "XX" }
Regards,
Amanda H.
Hi Torje,
I have some good news and some bad news. Good news is that you can store extra data in the meta field by including it in the main payload like so:
"message": {
"messageType": "DATA",
"data": {
"acc": 24.000000,
"lng": 17.000000,
"lat": 68.000000,
"bat": 4167 // this will be stored in the meta field
}
"appId": "GNSS"
}
Please try this format again. It works for me.
Now for the bad news: there is a bug in our API that prevents you from getting the meta for a specific device. The meta will always be set to {} when querying for a device. However, you can get around this by not specifying a device id and setting 'latest=true' ( ie https://api.nrfcloud.com/v1/location/history?latest=true ). This will bypass the bug and return the true meta field. You will get all devices returned and have to filter for the device you're interested in.
I am filing a ticket for the bug now. Thank you for bringing this to our atttention.
Cole
Hey again Cole,
My results were from polling one device only. I can confirm that it works as you've specified.
I would also like to mention that the meta-field appears empty when querying with no params. It works with 'latest=true', but seemingly not for anything else (of the ones I've tested at least)
Thank you for looking into this and clarifying how I can use it for now.
Kind regards,
Torje
Hey again Cole,
My results were from polling one device only. I can confirm that it works as you've specified.
I would also like to mention that the meta-field appears empty when querying with no params. It works with 'latest=true', but seemingly not for anything else (of the ones I've tested at least)
Thank you for looking into this and clarifying how I can use it for now.
Kind regards,
Torje