How to register dummy device to get credentials

How to create dummy device that I can connect to cumulocity IOT platform with unique device Id?
Also, how to get device credentials i.e., username and password of that device using postman or any other method.

@vaibhavi_ghumare

Please try the the Cumulocity Bulk upload feature. you can achieve your requirements. please follow the steps shared in the Cumulocity standard documentation.
https://cumulocity.com/guides/users-guide/device-management/#bulk-registration



Vachaspati Diwevedi

If you just need a quick way to create a dummy device, you could as well just start a simulator under Devices > Simulators in the Device management app. Running a simulator automatically create a new device on the tenant that you could then use to send measurements/alarms/events to.



Hendrik Naether

I don’t want to create simulator; I want to register device to cumulocity platform and access device credentials for that device.

Also, I am getting access forbidden error when I try to poll device credencials using external Id.
Code:
deviceCredentialsRepresentation = deviceCredentialsApi.pollCredentials(id);
System.out.println(deviceCredentialsRepresentation);
Error: {error=“security/Forbidden”,message=“Access is denied”,info=“https://cumulocity.com/guides/reference/openapi/”}

Can you share the request you made in postman?


I have tried using externalId, Authorization : Basic / and

And also with the device ID.


Also I have tried the same using DeviceCredencialsApi

The API description tells the "create device credentials” request requires role ROLE_DEVICE_BOOTSTRAP (link)

Can you do a GET /user/currentUser (open api link) and copy over the “effectiveRoles” fragment from your reponse? This will list your users current permissions.

I’ve did further investigation and found out the ROLE_DEVICE_BOOTSTRAP permission is a special one - you cannot grant it to your Tenant User. Instead you should use a pre-existing device bootstrapping user for this call.

To create Device Credentials programatically below steps are needed:

  1. Create a device request with your personal/authenticated User. Make sure it has the permission ROLE_DEVICE_CONTROL_ADMIN (api link)
  2. Try to request Device Credentials via this endpoint. Important: do not use your credentials, you have to use the bootstrap credentials provided by the platform (see here - but use the proper URL)
  3. Update the Device Request to “status: ACCEPTED” with your User. (api link)
  4. Repeat Step 2, this time the response will hold your Device Credentials.

See also the Device Integration using REST section in the docs for more info.

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.