I already know both the API KEY and the SESSION KEY. Infact I have 
everything needed to make the post, all that I need is to be able to 
specify the "1234@" parameter as part of the URL:

Eg: The URL should be: 
http://asdfghlkji / myserver.com:8080/books/palentology/common_groups.xml?session_key=a123j32nf4nfs23
where "asdfghlkji" is my API KEY and "a123j32nf4nfs23" is my SESSION 
KEY.

Currently I can only create a URL of the form: 
http://myserver.com:8080/books/palentology/common_groups.xml?session_key=a123j32nf4nfs23

Because Net::HTTP.start(url) will not allow me to input something like 
Net::HTTP.start(1234 / host.com:8080) or Net::HTTP.start(1234 / host.com, 
8080), it gives a "getaddrinfo: nodename nor servname provided, or not 
known" error when I attempt either of the above.

If I omit the "1234@" part and do something like 
Net::HTTP.start(host.com, 8080), my backend server gives me a 401 
Unauthorizes Access error.


When I implement your solution I still get the "getaddrinfo: nodename 
nor servname provided, or not known" error because it looks like the 
Net::HTTP.start method does not take the "1234@" parameter as it is 
supposed to.

Is there any way to add the "1234@" parameter to the URL.



7stud -- wrote:
> The first thing I would do is try to get a response from the server 
> without all the variables in your request string.  To begin with, you 
> need a valid API key and a valid session key.  Then you can try 
> something like this:
> 
> require 'net/http'
> 
> Net::HTTP.start("1234 / host.com:1200) do |http|
>   req = 
> Net::HTTP::Post.new("/users/John/contact_groups.xml?session_key=123456789")
> 
>   resp = http.request(req).body
>   puts resp
> end

-- 
Posted via http://www.ruby-forum.com/.