Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filebeat][Inputs][HTTP JSON] Multi-Step/API Requests #31117

Closed
BenB196 opened this issue Apr 3, 2022 · 10 comments
Closed

[Filebeat][Inputs][HTTP JSON] Multi-Step/API Requests #31117

BenB196 opened this issue Apr 3, 2022 · 10 comments

Comments

@BenB196
Copy link

BenB196 commented Apr 3, 2022

Describe the enhancement:

I'd like to request the ability to specify running multiple steps (API calls) in a single HTTP JSON input configuration.

Describe a specific use case for the enhancement or feature:

There are some APIs which require you to first authenticate against an auth endpoint, to get an API token, to then use to execute an API call. This requires 2 different URLs/APIs to be used in a single input.

Example Flow

An example of this type of flow.

  1. You have a clientId and a secret, and you make a call like:
curl -X POST -u "<clientId>:<secret>" my-api.com/auth
  1. This API returns a JSON value like:
{"accessToken": "<some_access_token>"}
  1. You then use this token in a second request to auth against the actual API:
curl -X GET -H "Authorization: <accessToken>" my-api.com/realAPI
  1. You then get the actual data you wanted.
{"APIData": "<api_data>"}

Reading through the docs, this doesn't seem possible currently.

@BenB196 BenB196 changed the title [Filebeat][Inputs][HTTP JSON] Multi-Step Requests [Filebeat][Inputs][HTTP JSON] Multi-Step/API Requests Apr 3, 2022
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Apr 3, 2022
@cmacknz
Copy link
Member

cmacknz commented Apr 4, 2022

Some support for multi-step or chained httpjson calls was added in #29816. It is tagged for 8.3 but looks like it made the cutoff for the upcoming 8.2 release.

I'm not sure it would support setting the Authorization header as in your example though, it likely needs to be extended further to allow that.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Apr 4, 2022
@efd6
Copy link
Contributor

efd6 commented May 6, 2022

I have a work-in-progress that would be able to do this in #31233 (though not as part of HTTP JSON). If this goes in, it is likely to be in the new V2 input system.

@andrewkroh
Copy link
Member

One use case example is JAMF Protect. https://docs.jamf.com/jamf-protect/documentation/Jamf_Protect_API.html

@ShourieG
Copy link
Contributor

@BenB196 Hey there, are you still looking for this feature to be implemented in httpjson or were you able to solve the issue you were facing ?

@BenB196
Copy link
Author

BenB196 commented Oct 20, 2022

Hi @ShourieG I've unfortunately not have a chance to look into whether #32222 resolved my issue. I'll see if I can test this in the next week or so.

@ShourieG
Copy link
Contributor

@BenB196 any updates on this ?

@BenB196
Copy link
Author

BenB196 commented Nov 25, 2022

Hi @ShourieG I was looking into this, but unless I'm missing something the chain configuration options aren't available via the Fleet Integration UI (I'm on Kibana 8.4.2), so I don't think I can actually test this feature in a custom integration setup currently.

@andrewkroh
Copy link
Member

This is likely fully possible with the new CEL input.

@ShourieG
Copy link
Contributor

Closing this issue for the moment, since an alternative solution using CEL is available

@ShourieG ShourieG removed their assignment Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants