GET
res = RestClient::Request.execute(
method: :get,
url: ES_SEARCH_URL,
timeout: 30,
headers: {params: params}
)
POST with JSON body
res = RestClient::Request.execute(
method: :post,
url: url,
timeout: 30,
payload: json_body,
headers: {:content_type=>"application/json", :params => params}
)
Post without JSON body
res = RestClient::Request.execute(
method: :post,
url: url,
timeout: 30,
headers: {:content_type=>"application/json", :params => params}
)
网友评论