Http.post the whole table

Hi there,

I’m looking at this link: Convert results to JSON and send them to a URL | InfluxDB OSS 2.0 Documentation, where a code excerpt is as follow:

import "http"
import "json"

from(bucket: "noaa")
  |> filter(fn: (r) => r._measurement == "average_temperature")
  |> mean()
  |> map(fn: (r) => ({ r with
    jsonStr: string(v: json.encode(v: {"location":r.location,"mean":r._value}))}))
  |> map(fn: (r) => ({r with
    status_code: http.post(
      url: "http://somehost.com/",
      headers: {x:"a", y:"b"},
      data: bytes(v: r.jsonStr)
    )
  }))

This sends a http post for each of the records in the table.

My question: is there a way to send the whole table in 1 http.post request?

Thanks

Usually, that’s an approach that doesn’t scale very well (not just in influxdb, but many many programming languages) . At some point, it’s just too much data to handle, either on the sender end, the transport in the middle, the receiver end, or the receiver application behind the endpoint.

Is there a specific problem you’re seeing with the way it’s working currently? What’s the problem you need to solve?

1 Like