Hello there
While using a multi tenancy apama script I want to assign a device to a device group via simple Post request:
https://{tenant}/inventory/managedObjects/{groupdID}/childAssets
body: { managedObject: { id: {deviceId}}
Using CumulocityRequestInterface produces the following error:
Finding device data from database failed : Some managedObjects don’t exist in database: '[ID [type=com_cumulocity_model_idtype_GId, value=461786690]]
The error is telling me that the managedObject of the device can not be found for the tenant, but it is available.
Also, If no managedObjects could be found, than the request should fail already for the groupId in the request url, but it doesnt.
If I use the same script for a single tenant apama engine, everything works fine.
Are there any restrictions on CumulocityRequestInterface while using multi tenancy or is there a better way to achieve a group device assignment?
View code:
var requestUrl := "https://{tenant}/inventory/managedObjects/{groupdID}/childAssets";
requestIface := CumulocityRequestInterface.connectToCumulocity();
dictionary<string,any> params := new dictionary<string, any>;
dictionary<string,any> paramssub := new dictionary<string,any>;
paramssub.add("id", deviceId);
params.add("managedObject", paramssub);
Request request := requestIface.createRequest("POST", requestUrl, params);
log request.toString() at INFO;
request.execute(ResponseHandler().responseHandler);
Thanks in advance
Greets David