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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Get Property Definitions by Template

jmay1
5-Regular Member

Get Property Definitions by Template

I am trying to figure out how to get property definitions for a template. I've tried creating my own service with "TemplateName" as an input using this snippet:


var params = {
      category: undefined /* STRING */,
      type: undefined /* BASETYPENAME */,
      dataShape: undefined /* DATASHAPENAME */
};

     // result: INFOTABLE dataShape: PropertyDefinition
     var result = ThingTemplates[TemplateName]GetPropertyDefinitions(params);

But it is returning a blank infotable, I'm assuming because my parameters are all undefined?

The only way I can seem to get a list of properties is by ThingName.

5 REPLIES 5

It seems to be a bug, becouse the same for services works:

var params = {

  category: undefined /* STRING */,

  type: undefined /* BASETYPENAME */,

  dataShape: undefined /* DATASHAPENAME */

};

// result: INFOTABLE dataShape: ServiceDefinition

var result = ThingTemplates["wupUtilityUseThermalTT"].GetServiceDefinitions(params);

Either if you do a GetMetadata no Property definitions

var result = ThingTemplates["wupUtilityUseThermalTT"].GetMetadata();

chmaloof
7-Bedrock
(To:jmay1)

Use GetInstancePropertyDefinitions instead of GetPropertyDefinitions.

jmay1
5-Regular Member
(To:chmaloof)

I don't see that service anywhere?

chmaloof
7-Bedrock
(To:jmay1)

I don't know if the service is documented, but in the script editor you can find it in the Entities tab after you select your ThingTemplate.

jmay1
5-Regular Member
(To:chmaloof)

Found it! Thank you!

Top Tags