首页 > 其他 > 详细

解决方案

时间:2017-12-11 20:31:43      阅读:233      评论:0      收藏:0      [点我收藏+]

https://stackoverflow.com/questions/5957185/rest-client-ruby-gem-headers

 

@result = RestClient.post(
          ‘url‘,
          {:billingSourceCode => "code"},
          {:headers => {‘Content-Type‘ =>‘application/json‘, 
                       "Authorization" => "key",  
                       "Accept" => "application/json"},
                       {:cookies => {:session_id => "1234"}}
          })

The params for the email is not in quotes. {"email": email@example.com, "password": password}. 


hHeader = {"X-AppSecretToken" => ‘tokenID1_sanitized‘, "X-AgreementGrantToken" => ‘tokenID2_sanitized‘, "Content-Type" => ‘application/json‘}

hCustomer = RestClient.get("https://restapi.e-conomic.com/customers/5", hHeader) # => creates a response showing customer 5 (shown for example of GET)
body = {‘address‘ => ‘Example Street‘, ‘name‘ => ‘John Doe‘}.to_json
RestClient.post "https://restapi.e-conomic.com/customers/", body, hHeader)

  

解决方案

原文:http://www.cnblogs.com/znsongshu/p/8024843.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!