http.get() function

The http.get() function is experimental and subject to change at any time. By using this function, you accept the risks of experimental functions.

The http.get() function submits an HTTP GET request to the specified URL and returns the HTTP status code, response body, and response headers.

Function type: Miscellaneous

import "experimental/http"

  url: "http://localhost:8086/",
  headers: {x:"a", y:"b", z:"c"},
  timeout: 30s



The URL to send the GET request to.

Data type: String


Headers to include with the GET request.

Data type: Record


Timeout for the GET request. Default is 30s.

Data type: Duration

Response format

http.get returns a record that contains the following:


The HTTP status code returned by the GET request.

Data type: Integer


The response body.

Data type: Byte Array


Headers included with the response.

Data type: Record


Get the status of InfluxDB OSS
import "influxdata/influxdb/secrets"
import "experimental/http"
import "csv"

token = secrets.get(key: "READONLY_TOKEN")

response = http.get(
    url: "http://localhost:8086/health",
    headers: {Authorization: "Token ${token}"}

httpStatus = response.statusCode
responseBody = string(v: response.body)
responseHeaders = response.headers

// Response header data
date = responseHeaders.Date
contentLenth = responseHeaders["Content-Length"]
contentType = responseHeaders["Content-Type"]

// Use the returned data in a stream of tables
csvData = "#datatype,string,long,string
csv.from(csv: csvData)
  |> map(fn: (r) => ({
    httpStatus: httpStatus,
    responseBody: responseBody,
    date: date,
    contentLenth: contentLenth,
    contentType: contentType,

Set your InfluxDB URL

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.