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

ThingTemplate - Get all properties of template using Java sdk

SOLVED
vaishnavee
Amethyst

ThingTemplate - Get all properties of template using Java sdk

Hi,

I want to fetch the propertyDefinitions of a thingTemplate. I am calling GetMetadata service on the template - 

client.invokeService(RelationshipTypes.ThingworxEntityTypes.ThingTemplates, "MyTemplateName", "GetMetadata", new ValueCollection(), DEFAULT_TIMEOUT);

 This returns an empty propertyDefinitions infotable. The call works fine for entityType Things.

 

The rest call - GET <server>/Thingworx/ThingTemplates/MyTemplateName returns all the properties under path "effectiveShape/propertyDefinitions" in the response json.

 

How can I get the same using java sdk?

 

Regards,

Vaishnavee

1 ACCEPTED SOLUTION

Accepted Solutions

Re: ThingTemplate - Get all properties of template using Java sdk

I used an alternative api - 'GetInstanstanceMetadataAsJson' on ThingTemplate to get the metadata as a  JSONObject. This object is similar to the output of rest call GET <server>/Thingworx/ThingTemplates/MyTemplateName. 

View solution in original post

3 REPLIES 3

Re: ThingTemplate - Get all properties of template using Java sdk

I used an alternative api - 'GetInstanstanceMetadataAsJson' on ThingTemplate to get the metadata as a  JSONObject. This object is similar to the output of rest call GET <server>/Thingworx/ThingTemplates/MyTemplateName. 

View solution in original post

Re: ThingTemplate - Get all properties of template using Java sdk

Hi @vaishnavee.

 

You might want to also look at GetPropertyDefinitions.

 

Regards.

 

--Sharon

Re: ThingTemplate - Get all properties of template using Java sdk

Hi @slangley , Yes I tried that, returns _rows valueCollection of size zero. I dont know why it would do that. But only GetInstanceMetadataAsJSON worked for me.

 

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.