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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

ThingWorx with InfluxDB

wshih
6-Contributor

ThingWorx with InfluxDB

Hi all:

 

Does anyone use InfluxDB to record history data?

 

I try to use "PostText()" And "PostJSON()"

 

But I can't get right response.

 

Here is my script: 

QueryDB

var params = {
  url: "http://" + me.host + ":" + me.port + "/query?db=" + p_database,
  contentType: "application/x-www-form-urlencoded",
content: "q:SELECT * FROM sensor;", timeout: 10, username: me.user, password: me.password }; var result = Resources["ContentLoaderFunctions"].PostText(params);

 

InsertDB

var params = {
  url: "http://" + me.host + ":" + me.port + "/query?db=" + p_database,
content: "sensor,type=123,way=222 value={"p_water":0.0,"p_power_value":-1}", timeout: 10, username: me.user, password: me.password }; var result = Resources["ContentLoaderFunctions"].PostText(params);

 

Usually I get timeout, but it is successful to execute on the Postman.

 

1 REPLY 1
PaiChung
22-Sapphire I
(To:wshih)

Try with everything fully hardcoded and see if you get the same result or not (don't substitute in from properties and variables) This at least will eliminate one cause.

Also you can try setting the application log to trace for a while and fire the request and see if there is any extra info to figure out what might be wrong.

Announcements


Top Tags