Hi, I am just getting started with REST web services on Rails. I understand that REST is an architectural style. However, I was wondering if there is a commonly used format for sending back error messages. For example, to a successful ''create'' a REST service might respond with the XML for the newly created model, but what would it send back if the creation fails, maybe due to invalid data? thanks! Ingo -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Screencast by topfunky just came out today on RESTful Rails: http://www.peepcode.com/articles/2006/10/08/restful-rails ($9 - great value) -Ryan> I am just getting started with REST web services on Rails. I understand > that REST is an architectural style. However, I was wondering if there > is a commonly used format for sending back error messages. > > For example, to a successful ''create'' a REST service might respond with > the XML for the newly created model, but what would it send back if the > creation fails, maybe due to invalid data? > > thanks! > Ingo--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 10/8/06, Ingo Weiss <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi, > > I am just getting started with REST web services on Rails. I understand > that REST is an architectural style. However, I was wondering if there > is a commonly used format for sending back error messages. > > For example, to a successful ''create'' a REST service might respond with > the XML for the newly created model, but what would it send back if the > creation fails, maybe due to invalid data? > > thanks! > IngoSuccessful creations usually return a 201 Created response, along with a Location header with the permalink of the new resource. Validation errors return 400 Client Error, with an xml hash of the errors. This is according to ActiveResource anyway. I think the Atom Pub API is similar, yet it actually sends the new xml with a successful create, along with the Location header. -- Rick Olson http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---