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

Create thingshape and add properties via services

SOLVED
Highlighted
Garnet

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
Highlighted

Re: Create thingshape and add properties via services

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

8 REPLIES 8
Highlighted

Re: Create thingshape and add properties via services

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

Highlighted

Re: Create thingshape and add properties via services

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

Highlighted

Re: Create thingshape and add properties via services

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

Highlighted

Re: Create thingshape and add properties via services

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

Tags (1)
Highlighted

Re: Create thingshape and add properties via services

Hi @vaishnavee.

 

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

 

Regards.

 

--Sharon

Highlighted

Re: Create thingshape and add properties via services

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-Th...

 

Regards,

Vaishnavee

Highlighted

Re: Create thingshape and add properties via services

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

Highlighted

Re: Create thingshape and add properties via services

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

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!