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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Thingworx API : how to get Timestamp ?

Lo_ry96
6-Contributor

Thingworx API : how to get Timestamp ?

Hi , I'm interessted in getting data from Thingowrx API and format it then store it in InfluxDB. 

 

I'm using Thingworx API as follows: https://thingworxplatforme/Thingworx/Things/Machine_A/Properties 

 

Where can i get timestamp ? 

 

thanks 

3 REPLIES 3
mstarnaud
13-Aquamarine
(To:Lo_ry96)

Hi Lo_ry

 

I'm not sure what you mean. Do you just want the current time in Thingworx and send it to Influx? If so, you can look into those 2 lines of code :

var TestVariable1 = new Date();
var TestVariable2 = (new Date()).getTime();

Then you can use those variables and send them as parameters to the service that inserts the data in Influx. You can then decide which is the best format for your needs.

 

Please let us know if one of those solves your issue. And if not, can you provide more details on what you're trying to accomplish.

Rocko
17-Peridot
(To:Lo_ry96)

You could also use configure ThingWorx to use Influx as persistence provider and make the properties logged, then they are already in Influx.

For this you need to make yourself familiar with Persistence Provider and Value Stream concepts. Both are documented in the help,

https://support.ptc.com/help/thingworx/platform/r9.5/en/#page/ThingWorx/Help/Composer/DataStorage/PersistenceProviders/using_influxdb_as_The_persistence_provider_2.html#

https://support.ptc.com/help/thingworx/platform/r9.5/en/#page/ThingWorx/Help/Composer/DataStorage/ValueStreams/ValueStreams.html#

 

Try also check out the Iot_Tips section in the community.

https://community.ptc.com/t5/IoT-Tips/tkb-p/tkb_iottips

 

 

Hi @Lo_ry96,

 

I wanted to follow up with you on your post to see if your question has been answered. 
If so, please mark the appropriate reply as the Accepted Solution. 
Of course, if you have more to share on your issue, please let the Community know so that we can continue to help you. 

 

Thanks,
Anurag
 

Top Tags