Skip to main content
1-Visitor
May 4, 2016
Question

Get Property Definitions by Template

  • May 4, 2016
  • 5 replies
  • 3405 views

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

1-Visitor
May 4, 2016

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();

5-Regular Member
July 25, 2016

Use GetInstancePropertyDefinitions instead of GetPropertyDefinitions.

jmay11-VisitorAuthor
1-Visitor
August 8, 2016

I don't see that service anywhere?

5-Regular Member
August 9, 2016

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.