Httpie: how to add request body for GET request? needed for elasticsearch restful-api call?

Created on 15 Sep 2015  路  2Comments  路  Source: httpie/httpie

the elasticsearch api may add request body for get. like this.

curl -XGET 'http://localhost:9200/_count?pretty' -d '
{
    "query": {
        "match_all": {}
    }
}
'

but the httpie seems not allow such usage.

question

Most helpful comment

HTTPie makes it possible to specify request body for any HTTP method, including GET. In your case, passing it via STDIN is probably the best way to go:

$ echo '{"query": {"match_all": {}}}' | http GET :9200/_count?pretty

All 2 comments

HTTPie makes it possible to specify request body for any HTTP method, including GET. In your case, passing it via STDIN is probably the best way to go:

$ echo '{"query": {"match_all": {}}}' | http GET :9200/_count?pretty

thanks

Was this page helpful?
0 / 5 - 0 ratings