Hi Korbinian,
I truly appreciate your detailed guidance. I figured out what caused the error, but I still don’t understand why. It’s not related to the authentication.
Here is the summary:
- SDK version: 1018.0.151
- The error only occurs in the APJ environment, the same code runs well with other env
- In APJ env:
- The error only occurs if I set this property to the managedObject before creating externalID: com_cumulocity_model_Agent: {} (I also set it in the other env and it can run well)
- Error code:
ManagedObjectRepresentation mo = new ManagedObjectRepresentation();
mo.setName("test");
mo.setType("test");
mo.setProperty("com_cumulocity_model_Agent", "{}"); // No error without this line
mo = inventoryApi.create(mo);
ExternalIDRepresentation externalIDRepresentation = new ExternalIDRepresentation();
externalIDRepresentation.setExternalId(externalId);
externalIDRepresentation.setType("c8y_Serial");
externalIDRepresentation.setManagedObject(mo);
identityApi.create(externalIDRepresentation);
This is not the 1st time I encountered an error in APJ. This is an error I’ve encountered before, and it seems like it was fixed at some point: https://tech.forums.softwareag.com/t/cumulocity-notificaion-2-listen-to-device-notifcation/284834/11?u=elcarim1802