Skip to main content
pshashipreetham
18-Opal
18-Opal
June 6, 2023
Solved

How Can I get a All Thing Templates

  • June 6, 2023
  • 1 reply
  • 1058 views

Hi,

 

I have a Thing Template named "CommonThingTemplate", there are 5 ThingTemplates created based on the CommonThingTemplate.

 

Now how can I get all the ThingTemplates created based on the CommonThingTemplate?

 

Thanks,

 

Best answer by nmutter

You could use

let result = ThingTemplates["CommonThingTemplate"].GetIncomingDependenciesAsNetwork({
	maxDepth: 1 /* NUMBER {"defaultValue":10} */,
	maxItems: undefined /* NUMBER {"defaultValue":500} */
});

// only consider items with parentType == "ThingTemplate"

I am not aware of a direct query like 'QueryImplementingThingTemplates' which exists for Things (QueryImplementingThings).

 

1 reply

nmutter16-PearlAnswer
16-Pearl
June 6, 2023

You could use

let result = ThingTemplates["CommonThingTemplate"].GetIncomingDependenciesAsNetwork({
	maxDepth: 1 /* NUMBER {"defaultValue":10} */,
	maxItems: undefined /* NUMBER {"defaultValue":500} */
});

// only consider items with parentType == "ThingTemplate"

I am not aware of a direct query like 'QueryImplementingThingTemplates' which exists for Things (QueryImplementingThings).