Skip to main content
7-Bedrock
June 13, 2018
Question

ThingWorx with InfluxDB

  • June 13, 2018
  • 1 reply
  • 1493 views

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

22-Sapphire I
June 13, 2018

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.