aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/README
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-01-17 00:46:32 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-01-17 00:46:32 +0000
commite00e6a29410e4ae75abc0480a4d79d07b29008a8 (patch)
tree4daed4701de72e45da4dfb431eeef120e764321a /activeresource/README
parentd38417fc02bc12f1182c0821eda6b58ef3b8ca5a (diff)
downloadrails-e00e6a29410e4ae75abc0480a4d79d07b29008a8.tar.gz
rails-e00e6a29410e4ae75abc0480a4d79d07b29008a8.tar.bz2
rails-e00e6a29410e4ae75abc0480a4d79d07b29008a8.zip
Interpret 422 Unprocessable Entity as ResourceInvalid. Closes #7097.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5967 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activeresource/README')
-rw-r--r--activeresource/README12
1 files changed, 6 insertions, 6 deletions
diff --git a/activeresource/README b/activeresource/README
index a657e3a471..702ab7efed 100644
--- a/activeresource/README
+++ b/activeresource/README
@@ -118,7 +118,7 @@ as the id of the ARes object.
# when save is called on a new Person object. An empty response is
# is expected with a 'Location' header value:
#
- # Response (200): Location: http://api.people.com:3000/people/2
+ # Response (201): Location: http://api.people.com:3000/people/2
#
ryan = Person.new(:first => 'Ryan')
ryan.new? #=> true
@@ -184,7 +184,7 @@ exception.
==== Validation errors
Creating and updating resources can lead to validation errors - i.e. 'First name cannot be empty' etc...
-These types of errors are denoted in the response by a response code of 400 and the xml representation
+These types of errors are denoted in the response by a response code of 422 and the xml representation
of the validation errors. The save operation will then fail (with a 'false' return value) and the
validation errors can be accessed on the resource in question.
@@ -194,7 +194,7 @@ validation errors can be accessed on the resource in question.
#
# is requested with invalid values, the expected response is:
#
- # Response (400):
+ # Response (422):
# <errors><error>First cannot be empty</error></errors>
#
ryan = Person.find(1)
@@ -210,13 +210,13 @@ If the underlying Http request for an ARes operation results in an error respons
exception will be raised. The following Http response codes will result in these exceptions:
200 - 399: Valid response, no exception
- 400: ActiveResource::ResourceInvalid (automatically caught by ARes validation)
404: ActiveResource::ResourceNotFound
409: ActiveResource::ResourceConflict
+ 422: ActiveResource::ResourceInvalid (rescued by save as validation errors)
401 - 499: ActiveResource::ClientError
500 - 599: ActiveResource::ServerError
-
+
=== Authentication
Many REST apis will require username/password authentication, usually in the form of
@@ -227,4 +227,4 @@ in the Url of the ARes site:
self.site = "http://ryan:password@api.people.com:3000/"
end
-For obvious reasons it is best if such services are available over https. \ No newline at end of file
+For obvious reasons it is best if such services are available over https.