Curl using ruby Curl using ruby curl curl

Curl using ruby


To send JSON data with HTTPI/curb, just set your JSON string as the request body as follow:

require 'httpi'require 'curb'require 'json'  # ...  req.body = {"id"=>"12341234","fieldsRequested"=>["title","state","component"]}.to_json# Then set your custom headersreq.headers = {"Accept" => "application/json", "Content-Type" => "application/json"}

Also do not enable the multipart_form_post option since multipart POST is not needed:

req.auth.gssnegotiateresp = HTTPI.post req do |http|  http.use_sslend