Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi,
I want to get the multiple entries of a properties by passing the URL.
For eg: When i pass the URL " ge2-****.cloud.thingworx.com/Thingworx/Things/Trucks/Properties?method=get&Accept=application/json "
I should get the following result:
{"iot":[ // When i fired, Its showing "rows", I want it to be "iot"
{
"ID": "1",
"TruckID": "T101",
"PalletID": "P101",
"TransitTime": "10:02:01",
"CurrentLoc": "Kochi",
"Health": "Good",
"Source": "Trivandrum",
"Destination": "Mumbai",
"Shipper": "EY",
"Remarks": "Asset valuable",
"Action": "Action"
},
{
"ID": "2",
"TruckID": "T101",
"PalletID": "P102",
"TransitTime": "10:02:01",
"CurrentLoc": "Kochi",
"Health": "Good",
"Source": "Trivandrum",
"Destination": "Mumbai",
"Shipper": "EY",
"Remarks": "Asset valuable",
"Action": "Action"
},
]}
Solved! Go to Solution.
I am not sure if I understood correctly or not, but I guess you might want to get properties with values for "Trucks" in your ThingWorx platform, not just from one truck, right?
If yes, you might have defined a thing template for trucks. Then you can get all implementing things with data from the thing template by using below rest api.
ge2-****.cloud.thingworx.com/Thingworx/ThingTemplates/PTC.Demo.Assets.MRIMachineTemplate/Services/GetImplementingThingsWithData?method=post&Accept=application/json
One thing you have to remember is that the "post" method is not enabled by default because of security issues. So if you want to execute services thru rest apis, please make "Allow Request Method Switch" enabled from the "PlatformSubsystem" in your composer.
Daniel
I am not sure if I understood correctly or not, but I guess you might want to get properties with values for "Trucks" in your ThingWorx platform, not just from one truck, right?
If yes, you might have defined a thing template for trucks. Then you can get all implementing things with data from the thing template by using below rest api.
ge2-****.cloud.thingworx.com/Thingworx/ThingTemplates/PTC.Demo.Assets.MRIMachineTemplate/Services/GetImplementingThingsWithData?method=post&Accept=application/json
One thing you have to remember is that the "post" method is not enabled by default because of security issues. So if you want to execute services thru rest apis, please make "Allow Request Method Switch" enabled from the "PlatformSubsystem" in your composer.
Daniel
Thank you daniel!
I also tried getting using:
I am getting the required output.
But this method is for listing the things. What i asked was i want to get logged values of a property.
If you want to get all the logged values for each things, you should use the "QueryPropertyHistory" or other queries based on your condition that you want to get recursively by using the name of all implementing things from the "GetImplementingThings" result.
Hello,
You can use the REST API to get properties off of a thing like this: http://localhost/Thingworx/Things/MyThing/Properties
To retrieve this as JSON, add "?Accept=application/json" to the end of the previous link
Hope this helps!
Tori