Setting sourceTime metadata in Azure Digital Twins

160 views Asked by At

I try to use Java SDK to set sourceTime in Digital Twin as described here: https://learn.microsoft.com/en-us/azure/digital-twins/how-to-manage-twin#update-a-propertys-sourcetime. But after upload values I get 400 with comment

"Cannot patch property metadata 'sourceTime'. Please provide a valid patch document.

I have permissions to ADT, there isn't problem.

For setting sourceTime I use following code:

JsonPatchDocument jsonPatchDocument = new JsonPatchDocument();
jsonPatchDocument = jsonPatchDocument.appendReplace("/$metadata/pitch/sourceTime", "2022-04-11T13:17:53.7648958Z");
jsonPatchDocument = jsonPatchDocument.appendReplace("/pitch", 10.5);

digitalTwinsClient.updateDigitalTwin("123", jsonPatchDocument);

Lib version: azure-digitaltwins-core:1.2.1

What am I doing wrong?

1

There are 1 answers

0
Myth On BEST ANSWER

This works with the newer version of API/SDKs as mentioned in the docs Please use - 1.3.0-beta.1.