# Post & put probelms with restclient

**URL:** <https://www.ruby-forum.com/t/post-put-probelms-with-restclient/161281>\
**Category:** Ruby\
**Created:** [February 25, 2009, 12:59am UTC](https://www.ruby-forum.com/t/post-put-probelms-with-restclient/161281 "2009-02-25T00:59:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewneal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4491bb/32.png) [@andrewneal](https://www.ruby-forum.com/u/andrewneal)\
**Post date:** [February 25, 2009, 12:59am UTC](https://www.ruby-forum.com/t/post-put-probelms-with-restclient/161281/1 "2009-02-25T00:59:41Z")

</div>

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](http://localhost:3000/testservers/1)’

print result

RestClient.post ‘[http://localhost:3000/testservers](http://localhost:3000/testservers)’,:name=\> ‘test server  
c’

running this returns

\<?xml version="1.0" encoding="UTF-8"?\> 2009-02-24T22:10:30Z 1 test a 1 2009-02-24T22:10:30Z /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
