Recently I had been having trouble with one of our test devices (shadow was corrupted) on nrfCloud so I decided to delete it and then re-provision and re-add it to nrfCloud to start fresh (something we have done several times before).
We have a a python script that automates this process by doing the following steps:
- Loads modem firmware via J-link
- loads at_client via J-link
- gets the IMEI via UART
- generates the certificates by calling -> curl -X POST api.nrfcloud.com/.../{' + IMEI + '}/certificates -d "123456" -H "Authorization: Bearer XXXXXXXXXXX" -H "Content-Type: text/plain" -o' + IMEI + '.json'
-
- Loads the certs using the UART and at_client
- Generates a certs.csv with all the provisioned devices (the scrip can do multiple at once before uploading)
-
Uploades to nrfcloud using -> curl --location --request POST api.nrfcloud.com/.../devices --header "Authorization: Bearer XXXXXXXXX" --header "Content-Type: text/csv" --data-binary "@certs.csv
After running this script the bulk operation failed. with the following error:
{"errors":"A total of 1 error(s) occurred while processing the CSV [failed row indices (1-based)]: {\"Thing m8-351358811339107 already exists in account with different attributes\":[1]}."}
{ "message": "Cannot verify device ownership (missing tenantId attribute)", "code": 40410 }