Ruby NetHTTP post#592
|
|
Has anyone made a post work with Ruby? require ‘net/http’ require ‘uri’ url = URI.parse(‘http://localhost:8080/projects/test_project/cards.xml’) req = Net::HTTP::Post.new(url.path) req.basic_auth ‘my_user’, ‘password’ req.set_form_data({‘name’=>”My Card #{Time.new.to_s}”, ‘card_type_name’=>‘story’}, ’;’) res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) } puts res returns
#<net::httpclienterror:0x2adde80> I tried putting the ‘name’ and ‘card_type_name’ in the url, but that doesn’t work either. Why are all the examples for cUrl? How about Ruby!? |
|
|
Hi trpdaddy, all card attributes should be specified like this: card[attribute], And, if you use ActiveResource instead of Net::HTTP, should be very easy to build API in ruby Cheers |
