# Http\_poller input

**URL:** <https://discuss.elastic.co/t/http-poller-input/229764>\
**Category:** Logstash\
**Created:** [April 25, 2020, 1:29pm UTC](https://discuss.elastic.co/t/http-poller-input/229764 "2020-04-25T13:29:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hiba](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hiba/32/110919_2.png) [@hiba](https://discuss.elastic.co/u/hiba)\
**Post date:** [April 25, 2020, 1:29pm UTC](https://discuss.elastic.co/t/http-poller-input/229764/1 "2020-04-25T13:29:38Z")

</div>

Hi ,  
i want to receive data through HTTP requests using logstash.  
my file.conf look like this :  
input {  
http\_poller {  
urls =\> {  
url =\> "[http://api.v4.boosterbc.net/suggest/cities?term=hamma&lang=fr](http://api.v4.boosterbc.net/suggest/cities?term=hamma&lang=fr) "  
}  
request\_timeout =\> 60  
schedule =\> { every =\> "20s"}  
codec =\> "line"  
}

}  
output {  
elasticsearch {  
hosts =\> "localhost:9200"  
index =\> "contacts"  
}  
stdout { codec =\> rubydebug }  
}

But logstash terminates without giving any result.  
any help please !

 ![Capture](https://us1.discourse-cdn.com/elastic/original/3X/6/5/65934011677a39f81b5b3da5c24d6b725b205683.png)

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [April 25, 2020, 5:50pm UTC](https://discuss.elastic.co/t/http-poller-input/229764/2 "2020-04-25T17:50:07Z")

</div>

The Logstash logs say there's a syntax error.

Is your file valid/encoded correctly on Windows?  
Please check is UTF-8 encoded (e.g. use Notepad++).

I've tested the following and it works:

```auto
input {
	http_poller {
		urls => {
			url => "http://api.v4.boosterbc.net/suggest/cities?term=hamma&lang=fr"
		}
		request_timeout => 60
		schedule => { every => "20s" }
		codec => "line"
	}
}
output {
	elasticsearch {
		hosts => "localhost:9200"
		index => "contacts"
	}
	stdout { codec => rubydebug }
}

```

A comment: the response of the API you're targeting is JSON.  
You can use `codec => json` to convert it into a valid structured JSON document (and it will be indexed as such).

---

<div class="post-metadata">

**Author:** ![hiba](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hiba/32/110919_2.png) [@hiba](https://discuss.elastic.co/u/hiba)\
**Post date:** [April 28, 2020, 1:22pm UTC](https://discuss.elastic.co/t/http-poller-input/229764/3 "2020-04-28T13:22:25Z")

</div>

it works .  
Thank you

---

<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:** [May 26, 2020, 1:22pm UTC](https://discuss.elastic.co/t/http-poller-input/229764/4 "2020-05-26T13:22:26Z")

</div>

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