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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

ThingTemplate - Get all properties of template using Java sdk

vaishnavee
12-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

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

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. 

slangley
23-Emerald II
(To:vaishnavee)

Hi @vaishnavee.

 

You might want to also look at GetPropertyDefinitions.

 

Regards.

 

--Sharon

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.

 

Top Tags