# How to connect to an API using Logstash?

**URL:** https://discuss.elastic.co/t/how-to-connect-to-an-api-using-logstash/192123
**Category:** Logstash
**Created:** [July 24, 2019, 7:23pm UTC](https://discuss.elastic.co/t/how-to-connect-to-an-api-using-logstash/192123 "2019-07-24T19:23:54Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![EZprogramming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ezprogramming/32/57291_2.png) [@EZprogramming](https://discuss.elastic.co/u/EZprogramming)
#### Post date: [August 9, 2019, 6:24pm UTC](https://discuss.elastic.co/t/how-to-connect-to-an-api-using-logstash/192123/7 "2019-08-09T18:24:13Z")

</div>

**Logstash solution to this post:** ✅

```
http_poller {
  urls => {      
     <enter_custom_name> => {
      method => get
      url => "https://***"
      headers => {
        "Content-Type" => "application/json"
        <add_authorization_or_password>
      }
    }
  }
  request_timeout => 60
  codec => "json"
  type => "Http_poller"
  schedule => { "every" => "10s" }
}

```

The authorization part depends on if your endpoint requires one or not.

---

_[View the full topic](https://discuss.elastic.co/t/how-to-connect-to-an-api-using-logstash/192123)._
