cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Is there a method or API available to update the property persisted setting programmatically

PG_CG
6-Contributor

Is there a method or API available to update the property persisted setting programmatically

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:

https://servername/Thingworx/Things/thingname?reason=properties%20%3A%20propertyname%20%3A%20updated%0A

 

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

2 REPLIES 2

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'

https://www.ptc.com/en/support/article/cs286416

Announcements

Top Tags