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

ThingTemplate : Nuances, Tips & Tricks

Highlighted
Level 13

ThingTemplate : Nuances, Tips & Tricks

ThingTemplate

 

A ThingTemplate, at it's root is nothing but a class definition. Things are instances of a ThingTemplate which encapsulates business logic for a specific asset class.

 

This could be equated to that of a Class in an object-oriented programming concept. ThingTemplates provides initial state & implementation of behaviour for the Things implementing it. See ThingTemplates in Help Center & Similarities to Object-Oriented Programming for more.

 

ThingTemplate Use Cases

 

It's among the many building blocks for an IoT Solution which belong to the highest level objects created and maintained, i.e. Entities. There are several Entity Types in ThingWorx allowing users to model the physical world within the virtual realm of ThingWorx platform. There are following type of entities available within ThingWorx for modeling:

 

  • Things
  • Thing Shapes
  • Thing Templates

Additional useful read

 

Ways to explore the out of the box provided ThingTemplates

 

All the available ThingTemplates can be listed and reviewed by navigating to the /Server via the ThingWorx REST API. List of ThingTemplates can be reviewed by using one of the following :

  • <serverName>:<portNumber>/Thingworx/Server in a web browser and then locate and click on the ThingTemplates, or by;
  • Typing <serverName>:<postNumber>/Thingworx/ThingTemplates in the web browser

Either of the above listed options will display the following list in the web browser

 

picList of ThingTemplates

List shows all available ThingTemplates i.e. ThingTemplates that were provided OOTB and the ones that were created by the users as well. Using the column isSystemObject one can verify if the displayed ThingTemplate is provided OOTB or is custom one created by the user.

 

Accessing ThingTemplate Class description / details

 

This is covered under the JavaDocs for the ThingWorx Platform API, which can be accessed via the API Documentation

 

Search for ThingTemplate for following result

 

picAPI Documentation: ThingTemplate

While creating a custom ThingTemplate outside of ThingWorx composer, e.g. creating ThingWorx extension it is must to have following two entities in the metadata.xml file.

 

 

<Entities>
        <ThingTemplate>
        </ThingTemplate>
</Entities>

Note: If Eclipse Plugin is used for creating the ThingTemplate, above mentioned entries will automatically be created in the metadata.xml

 

 

Tips & tricks

Basic troubleshooting 

Best Practises