Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Need to change the property persisted setting for multiple ThingShapes using service.
Found the below API which is getting triggered when changing the property setting on the Composer:
but not getting what body/header/params need to be passed to the above PUT request.
If anyone has any idea about this please provide the details.
Also, is it a best practice if we remove the property definition and then add it again with persisted setting change when there are 1000+ properties for which the aspect needs to be changed.
Thank you
Which PUT request do you mean? You seem to insert a wrong URL.
I did a quick research and also couldn't find a service / method for updating property definitions. Looking at Developer Tools in browser, there is a succession of API calls...
Thingworx/ThingShapes/<shape_name>/Services/RequestEdit
Thingworx/Resources/CurrentSessionInfo/Services/SetPersistentValue
Thingworx/ThingShapes/<shape_name>/Services/CancelEdit
But couldn't find and API call where a particular property gets updated.
Thingworx/ThingShapes/<shape_name>/Services/GetServiceDefinitions returns a list of methods / services, but there's nothing like SetPropertyDefinition or Update PropertyDefinition.
Removing and then adding the property definition back seem to work, but looks awkward.
Would also be interested to find out a way / best practice to achieve what you asked for.
Subscribed to the topic...
Found two related cases
The first one is regarding 'For programmatically created Properties the "persistent" flag cannot be changed after creating the Property'.
Somewhat close, but not really about your case. The resolution is to 'Remove the Property Definition and recreate with the new persistent flag'
https://www.ptc.com/en/support/article/cs301103
The second one is regarding 'Is there a setCategory() for programmatically setting the Category for an entity's property ?'
Almost spot on, and the resolution is 'Not part of Thingworx functionality: no out-of-the-box service available to update the category of an existing property. Workaround: remove existing property definition and recreate it with the new category'