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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

How to pass payload in Postman POST request for executing QueryImplementingThings service in TWX 8.5

RK_0705
12-Amethyst

How to pass payload in Postman POST request for executing QueryImplementingThings service in TWX 8.5

We have to apply query on LastConnection Datetime Property via postman.

 

Please share the snippet.

 

Thanks in advance.

4 REPLIES 4
PaiChung
22-Sapphire I
(To:RK_0705)

lastConnection is a property on the 'remote' thing, you could get this with either a 'Get' at <Server>:port/Thingworx/Things/<Name of Thing>/Properties/lastConnection

Or a 'Post' and query something like GetPropertyValues

First method would be simpler if all you needed was the value of the one property.

First method would require Visibility of the Thing and Runtime Property Read

Second method would require Visibility of the Thing and Runtime Service Execute of the service you will use and Runtime Property Read

RK_0705
12-Amethyst
(To:PaiChung)

@PaiChung 

The service we need to call is of ThingTemplate and not from Things, thatswhy we are running this service QueryImplementingThings to fetch all the things implementing that template via POST request.

 

Could you please help on that json paylod for POST request.

PaiChung
22-Sapphire I
(To:RK_0705)

Although it may be a large payload of information coming back, you could just run Query/GetImplementingThingsWithData and then pull the lastConnection from each entity.

 

You will want to use the QueryImplementingThingsWithNamedData end point on your Thing Template to limit the amount of data that is returned..

https://[HOST]/Thingworx/ThingTemplates/[THING  TEMPLATE NAME]/Services/QueryImplementingThingsWithNamedData

 

Then use the following raw body where you can adjust the row values to get different information back:

{"basicPropertyNames":{"dataShape":{"fieldDefinitions":{"name":{"name":"name","description":"Entity name","baseType":"STRING","ordinal":0,"aspects":{"isPrimaryKey":true}},"description":{"name":"description","description":"Entity description","baseType":"STRING","ordinal":0,"aspects":{}}}},"rows":[{"name":"name"}]},"propertyNames":{"dataShape":{"fieldDefinitions":{"name":{"name":"name","description":"Entity name","baseType":"STRING","ordinal":0,"aspects":{"isPrimaryKey":true}},"description":{"name":"description","description":"Entity description","baseType":"STRING","ordinal":0,"aspects":{}}}},"rows":[{"name":"lastConnection"}]}}

 

Announcements


Top Tags