3 Replies Latest reply on Feb 12, 2015 7:53 AM by paic RSS
    ciprianote Explorer

    How to create Things/Properties via Rest API

    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!



      • How to create Things/Properties via Rest API
        paic Collaborator

        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?



        • How to create Things/Properties via Rest API
          ciprianote Explorer

          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. 

           




            • How to create Things/Properties via Rest API
              paic Collaborator

              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.