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

Example of populating a stream via REST?


Example of populating a stream via REST?

Can someone point me to an example or tutorial of how to populate a stream using RESTful syntax?

The formal ThingWorx education discusses streams in the context of the vending machine example BUT populates the actual values (temperature and humidity) using a timer that is feed by a simulator.

I however, rather than a simulator, have the actual values on a Linux box and need to populate the stream (push to the cloud) with a RESTfull call using curl.

I don't mind hacking it out myself, just need a little more to go on - documentation or example?

Thanks for any pointers.


Hi Beck,

If you have a Linux Box, better than doing a RESTful calls with curl *, you should look on EDGE technology ( ), then you can use it's different tools to integrate remote data:

  • EDGE Microservers --> Already compiled distribution for different Operating System and Architectures, to
    • Interact with remote directories ( copy back/forth files for instance )
    • Interact with remote things using Lua Script ( you can bind, properties, services and events )
    • Remote VNC for Windows
    • Connect to and ADO database
    • Connect to OPC-DA
  • ​EDGE SDK --> SDK for different programing languages, to interact easily with ThingWorx Server
    • C
    • .NET
    • Java
    • iOS

* EDGE Technology uses websockets/secure websockets and a proprietary protocol in order to make efficient the communication between the remote device and ThingWorx Server. There's no sense on doing raw REST calls for remote devices, they provide better and more efficient connectivity than this.

Thanks Carles,

I will start exploring the SDKs with first emphasis on Java

Hello Beck,

There are multiple ways to populate the stream, at least those:

1. Associate some ValueStream with your Thing and make some property on your Thing logged (just check the "Logged" box). Then updates to this property will be written to the associated value stream. That's the most straightforward way, and also ThingWorx gives you nice control over the logging process (e.g. you can avoid redundant writes by specifying the thresholds for value changes).

2. Associate some ValueStream with your Thing and then call services like AddStringValueStreamEntry on your thing. That will give you more direct access to what is written into the stream.

3. Call AddStreamEntry on the Stream itself. That allows you to write directly into the stream without the Thing context, but I'm not sure if this works if you don't associate a ValueStream with your thing though. In any case, the signature for this call is rather complex, so I wouldn't bother.

The curl example for (1), assuming that I have a Thing called VendingMachine001 with a logged property "temperature" of type NUMBER:

curl -k -u Administrator:admin -H "Accept: application/json" -H "Content-Type: application/json" -d '{"temperature":106.6}' -X PUT "http://localhost:8080/Thingworx/Things/VendingMachine001/Properties/temperature" -v

This will set the temperature value to 106.6 and log it in the stream, associated with this thing.

/ Constantine

Thanks Constantine,

I have completed the curl example for my test and it makes sense.

Will explore options 1,2,3 as you outlined in reply to experiment with alternate methods.

Thanks again for the pointers.

-- Beck

The initial question has been answered correctly, but I can't find a way to mark it other than "Assumed Answered".

If someone knows how to mark it "Answered" please do so or advise how I may mark it as such.

Note: I was able to mark the replies as "Correct Answer", so this applies only to the original post that started the discussion on Oct 19, 2015 4:05 PM.

Thanks to all for contributing.