Hello,
The wiki says that the put method of the Rest API's can write a value or create a new thing or property.
Which are the instructions that I need to use in order to create a thing and afterwards to add a new property?
Can you give me an example?
Thank you!
This is a rather extreme measure, in Thingworx we have added the CreateThing, CreateThingTemplate and CreateThingShape services which is the best practice. These services should give you the functionality that you need.
Adding properties through the Rest API is not commonly done, usually services within Thingworx will derive from information or calls and use that to create Properties, Shapes, Templates and Things. Is there a particular use case you have that this would not be possible?
Yes, let's suppose that we have an Android application which sends the values of it's sensors to ThingWorx via the Rest API's. And if I don't have already created the Thing and the Properties, I would like to create them via RestAPI.
It is probably better to do this from the actual connection made vs. over the REST API which won't be as secure nor dependable in a way.
Two possible scenarios.
1. Initial contact using the bare minimum of modeling you can have the device 'auto register' and Thingworx figure out who/what is connected and from there create the appropriate Modeled Remote Thing
2. Initial connection using a more comprehensive model, and then upon being connected, have the Device invoke services or trigger services Server side (over the secure encrypted WS connection) to create the necessary properties etc.
Those are better approaches vs. sending REST calls to create everything.