Multiple headers Multiple URLs

HI,
I’m trying to use telegraf with the HTTP plugin,

I want to make two different HTTP inputs, one to a URL with GET - this works
the other with POST and 2 values in the header, plus body

I can’t find a clear method to achieve this.

i understand I will need 2 different [[inputs.http]]
should the multiple headers be [inputs.http.headers] or headers = “xyz”
Cheers

Hello @mbooth,
Welcome! Please included multiple headers in the http input plugin:

## Optional HTTP headers
 # headers = {"X-Special-Header" = "Special-Value"}

And for the http output plugin please use

## Additional HTTP headers
  # [outputs.http.headers]
  #   # Should be set manually to "application/json" for json data_format
  #   Content-Type = "text/plain; charset=utf-8"

Does this help?

HI @Anaisdg

your example doesn’t show multiple headers, it only shows a single header

so my telegraf.conf should look similar to the below?

[[inputs.http]]
urls = [
" https://api.weather.com/v2/pws/observations/current?Id=123 ...etc
]
data_format = "json"
[[inputs.http]]
urls = [
" https://data-api.samknows.one/metric_data "
]
method = "POST"
content_encoding = "gzip"
body = '{"splits":["MAC_ADDRESS"],"metric":"httpgetmt","chartType":"aggregate"….etc
headers = {"Authorization" = "APIKEY"}
headers = {"Accept" = "application/json"}
data_format = "json"

Hello @mbooth,
I believe so. Have you tried it?