A
Andrew Nisbet
Hi all, I am hoping someone can shed some light on what I am doing wrong
here. I have a simple class that I created using the rails scaffold
script
TestServer
name :string
serverid :integer
I am trying to connect to it using restful webservices. Get and destroy
are working, but I cannot get post or put to work at all
my client code is very simple
#!/usr/bin/ruby
require 'restclient'
result = RestClient.get 'http://localhost:3000/testservers/1'
print result
RestClient.post 'http://localhost:3000/testservers',:name=> 'test server
c'
running this returns
<?xml version="1.0" encoding="UTF-8"?>
<testserver>
<created-at type="datetime">2009-02-24T22:10:30Z</created-at>
<id type="integer">1</id>
<name>test a</name>
<serverid type="integer">1</serverid>
<updated-at type="datetime">2009-02-24T22:10:30Z</updated-at>
</testserver>
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient/request.rb:136:in
`process_result': HTTP status code 422 (RestClient::RequestFailed)
from
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient/request.rb:99:in
`transmit'
from /usr/lib64/ruby/1.8/net/http.rb:543:in `start'
from
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient/request.rb:95:in
`transmit'
from
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient/request.rb:34:in
`execute_inner'
from
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient/request.rb:26:in
`execute'
from
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient/request.rb:12:in
`execute'
from
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient.rb:57:in
`post'
from test.rb:12
anyone have any ideas about what I am missing here?
Thanks
here. I have a simple class that I created using the rails scaffold
script
TestServer
name :string
serverid :integer
I am trying to connect to it using restful webservices. Get and destroy
are working, but I cannot get post or put to work at all
my client code is very simple
#!/usr/bin/ruby
require 'restclient'
result = RestClient.get 'http://localhost:3000/testservers/1'
print result
RestClient.post 'http://localhost:3000/testservers',:name=> 'test server
c'
running this returns
<?xml version="1.0" encoding="UTF-8"?>
<testserver>
<created-at type="datetime">2009-02-24T22:10:30Z</created-at>
<id type="integer">1</id>
<name>test a</name>
<serverid type="integer">1</serverid>
<updated-at type="datetime">2009-02-24T22:10:30Z</updated-at>
</testserver>
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient/request.rb:136:in
`process_result': HTTP status code 422 (RestClient::RequestFailed)
from
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient/request.rb:99:in
`transmit'
from /usr/lib64/ruby/1.8/net/http.rb:543:in `start'
from
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient/request.rb:95:in
`transmit'
from
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient/request.rb:34:in
`execute_inner'
from
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient/request.rb:26:in
`execute'
from
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient/request.rb:12:in
`execute'
from
/usr/lib64/ruby/gems/1.8/gems/rest-client-0.9/lib/restclient.rb:57:in
`post'
from test.rb:12
anyone have any ideas about what I am missing here?
Thanks