Connection parameters

  • HTTP URL:

    https://[YOUR_DOMAIN].decentlab.com/api/datasources/proxy/1/query?db=main&epoch=ms&q=[YOUR_QUERY]
    

The URL parameter values, db=main (database name) and epoch=ms (millisecond-resolution timestamps) reflect the most common cases. Nevertheless, you may modify them according to the InfluxDB specification for your special needs.

  • Additional HTTP Header:

    Authorization: Bearer [YOUR_API_KEY]
    

This additional HTTP header represents your credential to access the database. Please contact us if you haven’t received an API key already.

The following example shows how to access the HTTP API using curl with our demo server.

$ curl -G \
       -H 'Authorization: Bearer eyJrIjoiclhMRFFvUXFzQXpKVkZydm52b0VMRVg3M3U2b3VqQUciLCJuIjoiZGF0YS1xdWVyeS1hcGktZGVtby0yIiwiaWQiOjF9' \
       --data-urlencode 'q=SELECT value FROM "measurements" LIMIT 1' \
       --data-urlencode 'pretty=true' \
       'https://demo.decentlab.com/api/datasources/proxy/1/query?db=main&epoch=ms'
{
    "results": [
        {
            "series": [
                {
                    "name": "measurements",
                    "columns": [
                        "time",
                        "value"
                    ],
                    "values": [
                        [
                            1464383631403,
                            7
                        ]
                    ]
                }
            ]
        }
    ]
}

Note

--data-urlencode 'pretty=true' enables a pretty-printed output, which is useful only for debugging purposes.

Note

InfluxDB supports only JSON-formatted output which may require format conversions for your specific environment.

Query language

InfluxDB provides a time series-oriented special query language, InfluxQL. Although InfluxQL is similar to the generic SQL, there are significant differences. You may need to consult the documentation.

Besides simple data retrievals, InfluxQL supports useful mathematical and statistical functions executed on the server. Using such server-side processing can significantly reduce communication overheads, increasing overall system performance.

Reference implementations

For starting your development, we provide reference implementations in MATLAB, PowerBI, MS Excel, Python, and R.

Please feel free to integrate and adapt these implementations into your data processing tools.