# Http Poller call authenticate api issue

**URL:** https://discuss.elastic.co/t/http-poller-call-authenticate-api-issue/164528
**Category:** Logstash
**Created:** [January 16, 2019, 7:45pm UTC](https://discuss.elastic.co/t/http-poller-call-authenticate-api-issue/164528 "2019-01-16T19:45:52Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Haseeb\_Wali](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/haseeb_wali/32/39855_2.png) [@Haseeb\_Wali](https://discuss.elastic.co/u/Haseeb_Wali)
#### Post date: [January 16, 2019, 7:45pm UTC](https://discuss.elastic.co/t/http-poller-call-authenticate-api-issue/164528/1 "2019-01-16T19:45:53Z")

</div>

I am trying to read data from a REST API then i will put it in elastic search. So the problem i am having is how to call 2 seperate APIs in input component of logStash. below is explanation of the problem i am facing. I need help in 'Input' portion of sudo code i have written below. Thanks  
Input{  
#call first api(which is authenticate), filter it's response and save TOKEN from it  
#call second api to read records and send above received TOKEN in header  
}  
filter{  
#Filter second APIs response (which will bring data in json format). I can write this portion  
}  
output{  
#send this data to elastic (I am clear about this portion that how to do it)  
}

---

<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: [January 16, 2019, 8:41pm UTC](https://discuss.elastic.co/t/http-poller-call-authenticate-api-issue/164528/2 "2019-01-16T20:41:38Z")

</div>

I cannot think of a way to do this in a single logstash process. I would think about calling the REST APIs outside of logstash. Just wrap a shell script around some curl calls, or implement it with Powershell if you are on Windows. Then feed the data to a stdin input.

---

<div class="post-metadata">

### Author: ![FenixSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fenixsec/32/78596_2.png) [@FenixSec](https://discuss.elastic.co/u/FenixSec)
#### Post date: [January 25, 2019, 2:54am UTC](https://discuss.elastic.co/t/http-poller-call-authenticate-api-issue/164528/3 "2019-01-25T02:54:37Z")

</div>

Awesome. Thank you. I used X-Auth-Token for the application im pulling data from and worked.

headers =\> {  
Accept =\> "application/json"  
"X-Auth-Token" =\>

---

<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: [February 22, 2019, 2:55am UTC](https://discuss.elastic.co/t/http-poller-call-authenticate-api-issue/164528/4 "2019-02-22T02:55:32Z")

</div>

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