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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

ThingTemplate - Get all properties of template using Java sdk

vaishnavee
13-Aquamarine

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

ACCEPTED SOLUTION

Accepted Solutions
vaishnavee
13-Aquamarine
(To:vaishnavee)

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
vaishnavee
13-Aquamarine
(To:vaishnavee)

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

vaishnavee
13-Aquamarine
(To:slangley)

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


Top Tags