Http get request using libcurl in json format


(Dinesh Sriram) #1

Hi All,
I am using libcurl to add indices and retrieve search results. I would like
to know whether there is a way to send http get requests using libcurl in
json format?
For example, the request in curl is

curl -XGET http://localhost:9200/_all/tweet/_search?q=tag:warcraft

Its equivalent in libcurl is

curl_easy_setopt(curl_handle, CURLOPT_URL,
"http://localhost:9200/_search?q=tag:warcraft")

I would like to send the above request in json format (below).

curl -XGET http://localhost:9200/_search -d '{ "query" : { "term" : { "tag": "warcraft" } } }'

Is there a way to do this?

--


(Dinesh Sriram) #2

http://stackoverflow.com/questions/13236479/libcurl-http-get-request-in-json-format in
case if anyone's interested.

On Monday, November 5, 2012 12:28:57 PM UTC-5, Dinesh Sriram wrote:

Hi All,
I am using libcurl to add indices and retrieve search results. I would
like to know whether there is a way to send http get requests using libcurl
in json format?
For example, the request in curl is

curl -XGET http://localhost:9200/_all/tweet/_search?q=tag:warcraft

Its equivalent in libcurl is

curl_easy_setopt(curl_handle, CURLOPT_URL, "
http://localhost:9200/_search?q=tag:warcraft")

I would like to send the above request in json format (below).

curl -XGET http://localhost:9200/_search -d '{ "query" : { "term" : { "tag": "warcraft" } } }'

Is there a way to do this?

--


(system) #3