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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Add data to an InfoTable (Data Shape) using REST

grahamall
1-Newbie

Add data to an InfoTable (Data Shape) using REST

Is it possible to add rows to a things Infotable using REST? if it is can you please provide an example


The URL of the Thing/infotable is 



The columns of the table are valueHex, time, signal, station


But if I call:



I'm not sure how to construct a row of the table to add - Any sugestions?



5 REPLIES 5
smanley
13-Aquamarine
(To:grahamall)

Hi Graham,

You were close with your first API call, but since the property is an infotable, the value you pass in will be a JSON object. If you run the service in composer with the developer tools open, on the Network tab, you can see what is being passed into the property under Request Payload. Below is an example URL I used to do this. The JSON object must have the datashape defined.


https://SERVER/Thingworx/Things/TestTable/Properties/modemData?method=put&value={"dataShape":{"fieldDefinitions":{"valueHex":{"name":"valueHex","description":"","baseType":"STRING","ordinal":1,"aspects":{}},"time":{"name":"time","description":"","baseType":"STRING","ordinal":2,"aspects":{}},"station":{"name":"station","description":"","baseType":"STRING","ordinal":4,"aspects":{}},"signal":{"name":"signal","description":"","baseType":"STRING","ordinal":3,"aspects":{}}}},"rows":[{"valueHex":"30","time":"30","station":"30","signal":"30"}]}



SaeedMa

Thank you for your help but the code you have provided overwrites the infotable is is possible to append data?




adam11
5-Regular Member
(To:grahamall)

Hi Graham,

If you want to add a row, you will need to pass the entire InfoTable along with the row you've added.

Adam

Thanks, that suggests I'm on the wrong track, I was looking for a way to append data to a Thing in response to a push notification is there a way to do this? 




Hi Graham,
You can do, however, create a service named "AddDataToModemData" taking exactly the parameters you said. Inside of that service you could add the row programatically to that property which is InfoTable.
Hope it helps!
BR,
Vladimir



Announcements


Top Tags