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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Unable to execute service GetThingRelationships on ThingTemplate

vaishnavee
12-Amethyst

Unable to execute service GetThingRelationships on ThingTemplate

Hi,

 

I am trying out few operations on templates via java sdk. One of the use case is getting all the thing names that are derived from a particular template. According to the documentation, a simple invokeService call to GetThingRelationships should get this done cleanly. The service expects an input of maxDepth we want to keep searching the things. (e.g. vehicalTemplate -> CarTemplate -> ElectricCarTemplate -> TeslaCar1Thing, TeslaCar2Thing, TeslaCar3Thing etc ).

 

When tried to execute the call via java sdk - 

client.invokeService(RelationshipTypes.ThingworxEntityTypes.ThingTemplates, "templateName", "GetThingRelationships", new ValueCollection(), 30000)

 throws exception stating - Invalid service name.

 

Same goes for other services like - GetImpletementedShapes, GetThingTemplate etc. 

Are these not the valid services for  entityType templates? If so, why are they listed under Services section of my template in composer UI?

 

I am using ThingWorx 8.5, if it is version related issue. 

 

Any help is very much appreciated!

 

Regards,

Vaishnavee

1 ACCEPTED SOLUTION

Accepted Solutions

Hello Vaishnavee,

 

Looking at GetThingRelationships, this is a Thing service call to be executed at the Thing level. It cannot be executed at the Thing Template level. It along with the other services you described are displayed at the Thing Template level as they are intended to be passed on to the inheriting Things and executed there.

 

There are however some specific services that will help you achieve your use case. At the Thing Template level you can call either GetImplementingThings or GetImplementingThingsWithData depending on the return you are after. GetImplementingThingsWithData simply adds an extra column for the Thing's direct Thing Template.

View solution in original post

2 REPLIES 2

Hello Vaishnavee,

 

Looking at GetThingRelationships, this is a Thing service call to be executed at the Thing level. It cannot be executed at the Thing Template level. It along with the other services you described are displayed at the Thing Template level as they are intended to be passed on to the inheriting Things and executed there.

 

There are however some specific services that will help you achieve your use case. At the Thing Template level you can call either GetImplementingThings or GetImplementingThingsWithData depending on the return you are after. GetImplementingThingsWithData simply adds an extra column for the Thing's direct Thing Template.

vaishnavee
12-Amethyst
(To:tmisner)

Thank you @tmisner for the solution. The service GetImplementingThings was exactly what I was looking for!

Top Tags