Getting more from JSON Path from Http API


I have two questions about this input.

Can I use variables in the url I’m calling ?

For instance :


And second question, how can I manage an API authentication using this input ?

Same question with a token with a limited validity ?

Thanks ahead !

Did you read docs about REST API?

No, because I’m not requesting Graylog API so I didn’t think of it
I’m going to have a look. I’m not sure to get what I want from there though.

Please describe what do you want to achieve, it’s not very clear…


I want to know if it is feasible to get data from several Rest APIs within one JSon Path input using variables in the url called. Because I would be getting data from like 50 apis all identically formatted, including the url.

this is what I read :

API auth depends on auth header, add one of it to Input field: Additional HTTP headers

You could try:

  1. Authorization: Basic Zm9vOmJhcg==
  2. Authorization: Bearer ACCESS_TOKEN

Or another depends on application

Thanks for your answer.
I my specific case, it won’t work, because the token has an expiration :frowning:
But I learnt something thanks to you.

Why not use REST API to change token on expiration updating Input’s header field?

  1. Get all Inputs:
    GET /api/system/inputs
    curl -u user_token:token -H 'Content-Type: application/json' -H 'X-Requested-By: cli' ''

  2. Get json Input parameters:
    GET /api/system/inputs/INPUT_ID
    curl -u user_token:token -H 'Content-Type: application/json' -H 'X-Requested-By: cli' ''

  3. Update token parameters (for example field headers)
    PUT /api/system/inputs/INPUT_ID
    curl -i -X POST -u user_token:token -H 'Content-Type: application/json' -H 'X-Requested-By: cli' '' -d @update-headers.json

update-headers.json file should contains original Input parameters with updated field headers:

Requered parameters:

  "title": "string",
  "type": "string",
  "global": "boolean",
  "configuration": "object",
  "node": "string"

So my example file update-headers.json:

  "title": "Json test2",
  "global": false,
  "type": "org.graylog2.inputs.misc.jsonpath.JsonPathInput",
  "configuration": {
    "headers": "Authentication: token",
    "path": "$[1].number_of_orders",
    "throttling_allowed": false,
    "target_url": "",
    "interval": 1,
    "override_source": null,
    "source": "yourapi",
    "timeunit": "MINUTES"
  "node": "6279b6d3-bfc3-4394-9340-90f47c91b816"

Thanks for your very interesting answer.
It looks like you’re requesting Graylog API when I am not. I will be requesting another rest API from a different solution.

Nonetheless, I think I can find some inspiration in your message.
Maybe this JSON input is dedicated to request Graylog and nothing else ?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.