Append custom fragment to Onnx Managed Object

What product/components do you use and which version/fix level are you on?

Cumulocity / Machine Learning / Zementis 1014.0.213

Is your question related to the free trial, or to a production (customer) instance?

Production

What are you trying to achieve? Please describe it in detail.

We are building a service that uploads an ONNX model to Zementis and we need to add some meta data / custom fragments to the Managed Object representing the uploaded model

managedObjectRepresentation.setProperty("artifact_meta", artifactDto);
    managedObjectRepresentation.setLastUpdatedDateTime(null);
    ManagedObjectRepresentation updatedManagedObject = inventoryApi.update(managedObjectRepresentation);

Do you get any error messages? Please provide a full error message screenshot and log file.

Http status code: 422
{error=“inventory/Invalid Data”,message=“Cannot update managed object. : Cannot change binary metadata through inventory API.”,info=“URL”,details=“null”}

Have you installed all the latest fixes for the products and systems you are using?

N/A

Hi

The lastUpdated field cannot be updated.
Also it is better to create a new object so the c8y API is not going to update ALL properties but only the ones which have changed

ManagedObjectRepresentation deviceCopy = new ManagedObjectRepresentation();
deviceCopy.setId(yourMo.getId());
deviceCopy.setProperty("artifact_meta", artifactDto);
this.inventoryApi.update(deviceCopy);

Have a try and see if you still have an issue.

1 Like

Thank you Melanie, you are a star :slight_smile: Works like a charm. I have been struggling with this for hours.

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