Forum: Ruby RestClient Error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Raja T. (Guest)
on 2014-02-27 07:59
Hi All,
I'm using rest-client gem to send POST request but getting error that
"connect attempt failed".

Below are few details on this.

require 'rest-client'
url="http://<link>/accounts"

post=RestClient.post(url,{"email" =>
"removed_email_address@domain.invalid","password"=>'hello'},{"appkey" =>
"WsQILsaaKGkzrrzJ36","Content-type"=>"application/json"})

=> above post request helps to create user account with email and
password. I'm getting error that "connection attempt failed". But it was
succeeded with Chrome Plug-in(DHP - Dev HTTP Client).
Panagiotis A. (Guest)
on 2014-02-27 10:28
(Received via mailing list)
Hello,

On 27 Φεβ 2014, at 06:59 , Raja T. <removed_email_address@domain.invalid> wrote:

> Hi All,
> I'm using rest-client gem to send POST request but getting error that
> "connect attempt failed".

Can you connect to that server using curl? For example:

curl -v -H "Accept: application/json" -H "Content-type:
application/json" -X POST -d '{"one":"value_here", "two":"value_here"}'
http://URL/accounts

Please post full curl reply.

> => above post request helps to create user account with email and
> password. I'm getting error that "connection attempt failed". But it was
> succeeded with Chrome Plug-in(DHP - Dev HTTP Client).
>
> --
> Posted via http://www.ruby-forum.com/.


Panagiotis (atmosx) Atmatzidis

email:  removed_email_address@domain.invalid
URL:  http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5
Raja T. (Guest)
on 2014-02-27 11:23
Yes, I'm able to connect to the server using curl from windows XP
machine.
Worrying any mistakes from the above program.
This topic is locked and can not be replied to.