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
We have to apply query on LastConnection Datetime Property via postman.
Please share the snippet.
Thanks in advance.
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
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.
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"}]}}