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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Create thingshape and add properties via services

vaishnavee
12-Amethyst

Create thingshape and add properties via services

Hi,

 

I am connecting to Thingworx server using java sdk's ConnectedThingsClient. I want to create a thing shape at run time and add properties to it. I am using CreateThingShape service from Resources.EntityServices. But I can not find any out of the box service to add property definitions to this shape. Unlike Things/ThingTempaltes, we do not have any generic services under ThingShapes. 

 

Is there any way we can do this using OOTB services/ other apis from java sdk?

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Frustrating as heck! PTC does not disappoint its reputation of incomplete documentations - there is not a single completed documentation for TW available on official sites of product / PTC support sites.

 

After wasting a whole day, I finally found the service - AddPropertyDefinition by accident. It uses similar api as the service with same name on Things and Templates etc.But the datashape used is different. The services from Thing,Template use the property names as IsLogged, IsReadOnly, IsRemote. And this on ThingShape needs logged, readOnly, remote etc. Also (for reasons unknown) the similar service AddPropertyDefinitions is not supported by ThingShapes.

 

They might be sharing the complete and informative documentation only with licensed customers. But they need to understand that there are use cases where people want to take/put the data out of/in to ThingWorx and need not necessarily have the licensed instance with them.

Hope that this is not a 'creating a mandatory dependency' thing and that the TW team is just too busy in development to publish the documentation. 

View solution in original post

10 REPLIES 10

Frustrating as heck! PTC does not disappoint its reputation of incomplete documentations - there is not a single completed documentation for TW available on official sites of product / PTC support sites.

 

After wasting a whole day, I finally found the service - AddPropertyDefinition by accident. It uses similar api as the service with same name on Things and Templates etc.But the datashape used is different. The services from Thing,Template use the property names as IsLogged, IsReadOnly, IsRemote. And this on ThingShape needs logged, readOnly, remote etc. Also (for reasons unknown) the similar service AddPropertyDefinitions is not supported by ThingShapes.

 

They might be sharing the complete and informative documentation only with licensed customers. But they need to understand that there are use cases where people want to take/put the data out of/in to ThingWorx and need not necessarily have the licensed instance with them.

Hope that this is not a 'creating a mandatory dependency' thing and that the TW team is just too busy in development to publish the documentation. 

slangley
23-Emerald II
(To:vaishnavee)

Hi @vaishnavee.

 

We apologize for your frustration.  I am going to move forward to create an internal case for addressing the lack of completed documentation in the scenario you describe.

 

Please be assured we are constantly striving to improve our documentation, and we appreciate your feedback in helping us to achieve that goal.

 

Regards.

 

--Sharon

slangley
23-Emerald II
(To:slangley)

Hi @vaishnavee.

 

R&D is reviewing the documentation issue and would like to confirm which documentation were you using.  Was it the documentation delivered with the SDK or did you find it in Reference Docs or the ThingWorx Help Center?

 

Regards.

 

--Sharon

Hi @slangley ,

 

The documentation shipped with sdk contains - javadoc for classes, introductory pdf for sdk client based application and another pdf containing troubleshooting guide. I did not find any documentation in sdk that could help me with available apis for entities in case of services.

 

Also though the learning guides are very detailed regarding the platform's capabilities, deployment, mapping models etc, it does not touch the technical details for java sdk. 

I found one link here on the forum - https://community.ptc.com/t5/ThingWorx-Developers/ThingWorx-REST-API-Cheat-Sheet/td-p/532533. Though it would be very much helpful if it could be more detailed.

 

Regarding this particular issue, I found the required service by running a simple REST call to '/Thingworx/ThingShapes/<myShape>/Services/GetServiceDefinitions', as I could not find the services listed down on composer UI.

 

In the past I have posted questions for javadoc for services like UpdatePropertyValues where the expected input is InfoTable and the post body format must be known. I ended up debugging the sdk jar and the REST call that is created in writePropertiesVTQ api of ConnectedThingClient.

 

For the other development, I am referring to this developer forum, services listed on composer UI and similar REST apis as mentioned above, so sometimes it's a trial-and-error method.

 

Also, thank you @slangley for this quick response, it is very much appreciated. 

 

Regards,

Vaishnavee

slangley
23-Emerald II
(To:vaishnavee)

Hi @vaishnavee.

 

Thank you for providing the requested information.  I will keep you posted on feedback I receive from R&D.

 

Regards.

 

--Sharon

Hi @slangley 

 

Can you please help me also with another services using java sdk related doubt?
https://community.ptc.com/t5/ThingWorx-Developers/How-to-access-Value-stream-objects-services-via-Thingworx-edge/td-p/692319

 

Regards,

Vaishnavee

slangley
23-Emerald II
(To:vaishnavee)

Hi @vaishnavee.

 

Can you provide the version of the SDK you are running?

 

In regard to your last post, I see that someone else has already responded to that.

 

Regards.

 

--Sharon

Hi @slangley , sorry for the late reply. I'm using the latest sdk available - java-sdk-6.1.0.679.

slangley
23-Emerald II
(To:vaishnavee)

Hi @vaishnavee.

 

I just realized you mentioned you were running the latest version, but JAVA-SDK-6-2-0-220 was released in June of 2019.  Please see if the documentation available with that one is more of what you would expect.

 

Regards.

 

--Sharon

OldGoat
12-Amethyst
(To:slangley)

While you're at it, please get them to create COMPLETE documentation with examples for the rest of the widgets, entities, etc.  Right now I'm trying to figure out how to pass changed values after doing an edit on an advanced grid.  And.....very little documentation, no pictures, etc.  It mentions some sort of property in a service, but it doesn't say where they are located, how to use them, etc.  It's connected to EditComplete.  But it doesn't say how to pass the edited data to the database to be saved.  It says there's an example on the server under Things.  But this is a government computer - they remove all examples.  And I don't have permissions required to upload the xml file.  I have to rely on your documentation.  In the meantime, do you have any WRITTEN examples, with pictures, on how to set up an editable grid to work with a DB Thing service to save the data?

Top Tags