rest-client

ResponseExceptionMapper in cxf client

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 04:33:28
问题 I am trying to handle exceptions using the ResponseExceptionMapper class for my cxf client. ExceptionHandlingCode: public class MyServiceRestExceptionMapper implements ResponseExceptionMapper<Exception> { private static final Logger LOGGER = LoggerFactory.getLogger(MyServiceRestExceptionMapper .class); public MyServiceRestExceptionMapper () { } @Override public Exception fromResponse(Response response) { LOGGER.info("Executing MyServiceRestExceptionMapper class"); Response.Status status =

File upload with rest-client

怎甘沉沦 提交于 2019-12-12 02:07:40
问题 Model .. def self.upload_client_document(params) client_document = self.new :uploaded_data => params[:Filedata],:client_id => params[:client_id],:document_name => self.default_document_name,:document_description => self.default_description_name client_document.rename_document_name client_document.save! # RAILS_ROOT + client_document.public_filename This will return path to file like # C:/projects/test_project/client_documents/0000/0012/A100-bal.csv RestClient.post 'http://demo.testltd.com

Rails: External API Integration using RestClient (400 Bad Request) response code

为君一笑 提交于 2019-12-11 17:14:45
问题 I am building a digital library, and I have completed a lot of the functionalities needed. I am currently having an issue with integrating the digital library with a Learning Management System (LMS). I already have an admin authentication system for the digital library using the Devise gem . My goal is to allow users who want to access the digital library to login to the digital library using their Learning Management System (LMS) credentials (username and password). I have been provided with

Rails: External API Integration using RestClient (400 Bad Request)

早过忘川 提交于 2019-12-11 15:54:56
问题 I am building a digital library, and I have completed a lot of the functionalities needed. I am currently having an issue with integrating the digital library with a Learning Management System (LMS). I already have an admin authentication system for the digital library using the Devise gem . My goal is to allow users who want to access the digital library to login to the digital library using their Learning Management System (LMS) credentials (username and password). I have been provided with

Rest-Client Ruby Gem: Help creating get request with Headers, Query, and setting a proxy

孤者浪人 提交于 2019-12-11 13:14:28
问题 So far this is what I've come up with. RestClient.proxy = ENV("http_proxy") RestClient.head("Cookie","accessToken=#{@GottenTokenString}") #this line not working resp = RestClient.get("http://someServer/path/RestAPIPage.json",{:params => {:count => @count, :userCount => @userCount}}) The problem I have here is that I can't seem to add any headers to the get request. The API I am calling requires that a token be obtained and set to a cookie header. Seems that the REST API can't handle this. The

How to upload a file using RestClient in Ruby?

为君一笑 提交于 2019-12-11 11:41:42
问题 I am trying to upload a file in Ruby. Below is a sample of the REST call using curl. curl --sslv3 -k -v -i -X POST \ -H "Content-Type: multipart/mixed" \ -H "Accept: application/json" \ -H "Cookie: token=ABC; SESSION=13217EBA128F6ABC9E9AD095D602E4AB;" \ -F "metadata=@input_payload_file.json; type=application/json" \ -F "content=@MyFile.jpg; type=image/jpg" \ https://abc.com/attachments. Can some please give me an equivalent of above in Ruby. I have tried the following, with no success.

How to set returned Image Data as ng-src of image in AngularJS

喜夏-厌秋 提交于 2019-12-11 07:29:26
问题 I've got two ASP.Net Core methods at the moment - one tied to an API call, and one tied to a client-side Razor helper. They're both located in my HomeController.cs . API: Here's the API call: [HttpGet("api/GetImage")] public async Task<ActionResult> ImageFromPath() { RestClient client = new RestClient("http://IPADDRESS/cgi-bin/snapshot.cgi?channel=0"); RestRequest request = new RestRequest(Method.GET); request.AddHeader("cache-control", "no-cache"); request.AddHeader("authorization", "Basic

how to delete a saved request in chrome's arc (Advanced REST Client) extension?

久未见 提交于 2019-12-11 04:27:49
问题 How to delete a saved request in chrome's ARC (Advanced REST Client) extension? I currently have ARC extension installed in chrome and some requests saved. I looked for, but didin't find any way to delete a request from the "saved" list. tried to select the request and press delete key (from keyboard), but doesn't work tried to find some "delete" option on the menus, but didn't find extension link: https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo

Ruby RestClient.post for login form

[亡魂溺海] 提交于 2019-12-10 14:22:14
问题 I am attempting to login to a site using the following code: require 'rubygems' require 'nokogiri' require 'open-uri' require 'csv' require 'restclient' HEADERS_HASH = {"User-Agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.57.5 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.4"} page = Nokogiri::HTML(open("http://example.com/login", HEADERS_HASH)) token = page.css("form.login_box div input")[0]['value'] login_resp = RestClient.post("https://example.com/session", {

Omniauth + Google + Faraday + Behind the proxy = how setup proxy?

夙愿已清 提交于 2019-12-10 11:21:33
问题 My production server is Ubuntu 12 . I'm using Devise + OmniAuth to handle the Google authentication. But when Google returns a control to my application I get an error "Network is unreachable" . I assume it's because of server is behind the proxy. Here's error description: ------------------------------- Request: ------------------------------- * URL : http://efiling.uipv.org/users/auth/google_oauth2/callback?state=f4eaca9fbed2a77c0baac50cdbdccab7eee671179bb8fc43&code=4