cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Integrating InfluxDB with JMP using HTTP Request

There are many OpenSource data sources that emerge everyday. One such data source is InfluxDB  Their tag line is “We build cool stuff for developers who build cool stuff”. I happen to think that JMP is “cool stuff” but the question remains, “How can you integrate JMP’s ‘cool stuff’ with InfluxDB’s ‘cool stuff’”.

 

Luckily, there are 2 specific cool stuffs that can make this happen. The first is that InfluxDB publishes a well-documented way to get started and most importantly, a REST interface. The second is that JMP has a JSL object known as HTTP Request.

 

Needless to say I’m more familiar with HTTP Request than InfluxDB’s FluxQL language so for the most part, I focused on the posted examples with sample data.

 

To begin, I installed InfluxDB using HomeBrew and then using InfluxDB’s DataExplorer, I created

bryan_boone_0-1663342625682.png

 

I created a Bucket and uploaded data.

I then had to navigate to the API Tokens page in order to create an API Token I can use with the REST communication.

bryan_boone_1-1663342625699.png

 

 

And navigate to the Organization page for the org_id

bryan_boone_2-1663342625712.png

 

Finally, I was able to get JMP and InfluxDB chatting with JSL.

 

And this JSL snippet was really all it needed.

 

bryan_boone_3-1663342625726.png

 

 

  • url -  the location of my InfluxDB server
  • token - the token I obtained from my API Token page
  • authorization - the header that gets passed in every communication to InfluxDB
  • content_type - tells InfluxDB that I am passing a flux script (in this case, previously defined)
  • accept - tells InfluxDB that I’d like a csv file in return (please)
  • org_id - the organization id from the Organization page.

 

It is worth noting that line 24 is

  • Blob(flux)

Using Blob allows me to set the content type to

  • Content-Type: application/vnd.flux

This is what the InfluxDB is looking for. Using Blob allows me to set a content type to pretty much anything, whereas using Text, JSON, or XML will set the appropriate content type or allow you to only set compatible content types.

 

In the complete script, there is a flux variable that points to the FluxQL that I want to send to the server. Beware not all scripts generated in InfluxDB’s DataExplorer web app will execute without some modifications. A quick trip to the internet with your favorite search engine will help remedy errors.

And finally, I tacked on a GraphBuilder script since in JMP, for every data table there is a graph.

Have fun.

Comments
UersK

Thanks!

Recommended Articles