What product/components do you use and which version/fix level?
Cumulocity IoT 10.10
What are trying to achieve? Please describe in detail.
I am trying to create and register the device using a custom microservice. I am able to successfully create a new device record on the platform, register the externalId and create a new deviceRequest. But when i try to change hte status of new Device request to ACCEPTED state, i get an exception as follows
404 Not Found: [{“error”:“devicecontrol/Not Found”,“message”:“NewDeviceRequest for device id Test-3300-000028-Transport is in state WAITING_FOR_CONNECTION, (not PENDING_ACCEPTANCE)).”,“info”:“https://cumulocity.com/guides/reference-guide/”}]
How can i change the state of NewDeviceRequest to PENDING_ACCEPTANCE from WAITING. What could be the missing step here.
Do you get any error messages? Please provide a full error message screenshot and log file.
404 Not Found: [{“error”:“devicecontrol/Not Found”,“message”:“NewDeviceRequest for device id Test-3300-000028-Transport is in state WAITING_FOR_CONNECTION, (not PENDING_ACCEPTANCE)).”,“info”:“https://cumulocity.com/guides/reference-guide/”}]
Have you installed latest fixes for the products
No, We have microserivce developed with sdk v 1010.0.28 but the platform Backend version is at 1013.0143. Could this be a issue here.
I have tried that as well. I am not able to do that. I get the following error:
422 Unprocessable Entity: [{“error”:“devicecontrol/Invalid Data”,“message”:“Can transpose to ACCEPTED status only.”,“info”:“https://cumulocity.com/guides/reference-guide/”}]
requesting the device credentials once will automatically move the status into PENDING_ACCEPTANCE.
You can request the device credentials by using the bootstrap credentials on the following endpoint: https://cumulocity.com/api/10.13.0/#operation/postDeviceCredentialsCollectionResource
You won’t receive any credentials on that request as long as the status has not been ACCEPTED.
Thanks Tristan, I was actually doing that but i had a loot again at the link you shared and i realised that i forgot to add the ROLE_DEVICE_BOOTSTRAP role to the microservice. After adding the role and trying it out again it worked fine. Thanks for the help.
NewDeviceRequests have three statuses in their lifecycle: WAITING_FOR_CONNECTION, PENDING_ACCEPTANCE, and ACCEPTED. They can only be moved linearly from one status to the next, and they are only moved upon distinct actions being performed.
After the device registration is entered in UI the NewDeviceRequest is created in status WAITING_FOR_CONNECTION
It is moved to PENDING_ACCEPTANCE when the device requests its credentials for the first time (after NDR creation). No credentials are created or transferred in this step but it is necessary to confirm that the device can connect and is using the same external ID
After that it becomes possible to accept the registration in UI which will move the NewDeviceRequest to ACCEPTED
The first time the device requests its credentials again after the NewDeviceRequest is accepted credentials are created and returned as response. After this is completed the NewDeviceRequest is removed and the credentials can never be received again.
As you can see the device bootstrap process requires interactions from both the user and the device. We usually recommend that the device periodically (with exponential back-off) requests its credentials until it has obtained them (see: Device integration using REST - Cumulocity IoT Guides). The users can enter device registrations of known devices at any time.