# How to fetch events using REST api

**URL:** https://discuss.elastic.co/t/how-to-fetch-events-using-rest-api/196804
**Category:** Logstash
**Created:** [August 26, 2019, 3:54pm UTC](https://discuss.elastic.co/t/how-to-fetch-events-using-rest-api/196804 "2019-08-26T15:54:42Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![akhilsharma.in](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@akhilsharma.in](https://discuss.elastic.co/u/akhilsharma.in)
#### Post date: [August 26, 2019, 3:54pm UTC](https://discuss.elastic.co/t/how-to-fetch-events-using-rest-api/196804/1 "2019-08-26T15:54:42Z")

</div>

Hello team -

We have an use case where we need to get events using REST api. REST api call is protected with authorization token which we generate using a url which is a combination of some parameters.

Can we create input configuration for this kind of setup?

Thanks  
Akhil

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [August 26, 2019, 6:01pm UTC](https://discuss.elastic.co/t/how-to-fetch-events-using-rest-api/196804/2 "2019-08-26T18:01:15Z")

</div>

You cannot do that using an input. You may be able use a generator input to create a dummy event and then add fields to it using an http filter.

---

<div class="post-metadata">

### Author: ![akhilsharma.in](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@akhilsharma.in](https://discuss.elastic.co/u/akhilsharma.in)
#### Post date: [September 11, 2019, 3:29pm UTC](https://discuss.elastic.co/t/how-to-fetch-events-using-rest-api/196804/3 "2019-09-11T15:29:12Z")

</div>

I'm using http\_poller to use POST request. It is giving error with the body.

I added body as below:

body =\> '{ "grant\_type":"client\_credentials","scope":"domain" }'

Error I'm seeing after running it as Bad request: 400

"message" =\> "Parameter conditions "grant\_type" not met for actual request parameters: { "grant\_type":"client\_credentials","scope":"domain" }={}",

Please suggest corrections.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [October 9, 2019, 3:29pm UTC](https://discuss.elastic.co/t/how-to-fetch-events-using-rest-api/196804/4 "2019-10-09T15:29:14Z")

</div>

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