rest-client

Errno::ECONNRESET: Connection reset by peer in Rails using rest-client

倾然丶 夕夏残阳落幕 提交于 2019-11-29 15:21:10
We have a Ruby on Rails application and this has a "search" functionality (search for some company). From browser user key-in some name and hit search and this search make an rest api call to outside system and get us some search results. We are using " rest-client " (for Ruby on Rails). I noticed this seems to work for few hours and suddenly my search seems to be broken all of a sudden and I can see in my log I get: Errno::ECONNRESET: Connection reset by peer We tried to investigate this issue by looking in to logs and we dont see any logs. If we need to make this search work again we need to

“bad ecpoint” SSL error on fresh RVM Ruby 1.9.3 install on OSX Mountain Lion

核能气质少年 提交于 2019-11-29 12:48:21
Trying to use Ruby 1.9.3 & rest-client to make https requests like: RestClient.get('https://google.com') always gives me a SSL error, OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server key exchange B: bad ecpoint which I cannot figure out. bad ecpoint ? I've had no trouble making the same request with 1.9.3 & rest-client on another Mountain Lion machine. Notes about this machine: MacBook pro with fresh Mountain Lion install, where I originally had some trouble installing gcc-4.2 via the XCode command line tools, but eventually got gcc-4.2 via homebrew/dupes . I've

Getting ssl.SSLHandshakeException when using REST client with header but works fine with PostMan

血红的双手。 提交于 2019-11-29 11:05:23
I have an external REST resource with below details: The URL: abc.com/orders (the domain is with https ) I need to pass UserID as an HTTP header with key "user" value is "abcd" This would return an JSON response I am using below Java code for this: try { Client client = Client.create(); WebResource webResource = client.resource("abc.com/orders"); ClientResponse response = webResource.header("user", "abcd").accept("application/json") .get(ClientResponse.class); if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } String output =

Jackson mapping Object or list of Object depending on json input

谁都会走 提交于 2019-11-28 23:23:01
I have this POJO : public class JsonObj { private String id; private List<Location> location; public String getId() { return id; } public List<Location> getLocation() { return location; } @JsonSetter("location") public void setLocation(){ List<Location> list = new ArrayList<Location>(); if(location instanceof Location){ list.add((Location) location); location = list; } } } the "location" object from the json input can be either a simple instance of Location or an Array of Location. When it is just one instance, I get this error : Could not read JSON: Can not deserialize instance of java.util

HttpStatus become deprecated in API level 22

亡梦爱人 提交于 2019-11-28 22:05:23
问题 Usually I used to check for the server different code responses in my RestClient class using the org.apache.http.HttpStatus class as the following example: if (HttpStatus.SC_OK == restClient.getResponseCode()) { //200 OK (HTTP/1.0 - RFC 1945) return true; } else if (HttpStatus.SC_BAD_GATEWAY == restClient.getResponseCode()){ //502 Bad Gateway (HTTP/1.0 - RFC 1945) return false; } But recently the class became deprecated since API level 22 according to the official documentation This interface

How do I do basic authentication with RestClient?

淺唱寂寞╮ 提交于 2019-11-28 17:50:41
Does anyone know how to do basic authentication with RestClient ? I need to create a private repository on GitHub through their RESTful API. Mike Buckbee From the source it looks like you can just specify user and password as part of your request object. Have you tried something like: r = Request.new({:user => "username", :password => "password"}) Also if you look down in the Shell section of the ReadMe it has an example of specifying it as part of restshell . $ restclient https://example.com user pass >> delete '/private/resource' opsb The easiest way is to embed the details in the URL:

Errno::ECONNRESET: Connection reset by peer in Rails using rest-client

一个人想着一个人 提交于 2019-11-28 08:48:20
问题 We have a Ruby on Rails application and this has a "search" functionality (search for some company). From browser user key-in some name and hit search and this search make an rest api call to outside system and get us some search results. We are using " rest-client " (for Ruby on Rails). I noticed this seems to work for few hours and suddenly my search seems to be broken all of a sudden and I can see in my log I get: Errno::ECONNRESET: Connection reset by peer We tried to investigate this

“bad ecpoint” SSL error on fresh RVM Ruby 1.9.3 install on OSX Mountain Lion

早过忘川 提交于 2019-11-28 06:26:02
问题 Trying to use Ruby 1.9.3 & rest-client to make https requests like: RestClient.get('https://google.com') always gives me a SSL error, OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server key exchange B: bad ecpoint which I cannot figure out. bad ecpoint ? I've had no trouble making the same request with 1.9.3 & rest-client on another Mountain Lion machine. Notes about this machine: MacBook pro with fresh Mountain Lion install, where I originally had some trouble

How to download excel (.xls) file from API in postman?

我只是一个虾纸丫 提交于 2019-11-28 03:30:39
I am having an API-Endpoint and Authtoken for that API the said API is for .XLS report download, how can i view the downloaded .xls file using (if possible) POSTMAN? If it is not possible using postman what are the other programmatic ways I should be looking for? Try selecting "send and download" instead of "send" when you make the request. (the blue button) https://www.getpostman.com/docs/responses "For binary response types, you should select “Send and download” which will let you save the response to your hard disk. You can then view it using the appropriate viewer." If the endpoint really

Jackson mapping Object or list of Object depending on json input

天涯浪子 提交于 2019-11-27 14:44:11
问题 I have this POJO : public class JsonObj { private String id; private List<Location> location; public String getId() { return id; } public List<Location> getLocation() { return location; } @JsonSetter("location") public void setLocation(){ List<Location> list = new ArrayList<Location>(); if(location instanceof Location){ list.add((Location) location); location = list; } } } the "location" object from the json input can be either a simple instance of Location or an Array of Location. When it is