For when we talk about validation.
-- bk
-------- Original Message --------
Subject: Re: [rest-discuss] Bussiness layer error handling
Date: Sun, 18 Apr 2010 10:57:26 +0200
From: Jan Algermissen <algermissen1971(a)mac.com>
To: Jørn Wildt <jw(a)fjeldgruppen.dk>
CC: Rest List <rest-discuss(a)yahoogroups.com>
On Apr 17, 2010, at 9:22 PM, Jørn Wildt wrote:
Consider the situation where a client PUTs a new representation of
some
business object, for instance an update to an existing customer. On the
server side the software detects that some mandatory fields are not
completed. How should this information be returned to the client?
I want to be able to say more than just "400 Fields X,Y and Z needs
to be
completed" - the error information should be encoded in a
structured
way.
Beware that you cannot redefine the existing HTTP status codes. 400 means
Bad Request and not something application specific. What you should do
is choose the most appropriate HTTP error code and, as you suggest,
include the details in the body. In your example, that would be 422
Unprocessable Entitye (== syntactically correct, but semantic errors)
Jan
My first shot is to define an error media-type like
application/vnd.error+xml in which I can embed all sorts of error
information. The the HTTP response could be:
400 Fields X,Y and Z needs to be completed
Content-Type: application/vnd.error+xml
<errors>
<error>...</error>
</errors>
Is this on the right track? Are there any existing media types for this?
Thanks, Jørn
------------------------------------
Yahoo! Groups Links
-----------------------------------
Jan Algermissen, Consultant
NORD Software Consulting
Mail: algermissen(a)acm.org <mailto:algermissen%40acm.org>
Blog:
http://www.nordsc.com/blog/ <
http://www.nordsc.com/blog/>
Work:
http://www.nordsc.com/ <
http://www.nordsc.com/>
-----------------------------------
__._,_.___
Reply to sender <mailto:algermissen1971@mac.com?subject=Re:
[rest-discuss] Bussiness layer error handling> | Reply to group
<mailto:rest-discuss@yahoogroups.com?subject=Re: [rest-discuss]
Bussiness layer error handling> | Reply via web post
<
http://groups.yahoo.com/group/rest-discuss/post;_ylc=X3oDMTJxMzU2ZjZrBF9T...
| Start a New Topic
<
http://groups.yahoo.com/group/rest-discuss/post;_ylc=X3oDMTJlcmZmMWtlBF9T...
Messages in this topic
<
http://groups.yahoo.com/group/rest-discuss/message/15298;_ylc=X3oDMTM2YTc...
(3)
Recent Activity:
* New Members
<
http://groups.yahoo.com/group/rest-discuss/members;_ylc=X3oDMTJmdjExYzE5B...
1
Visit Your Group
<
http://groups.yahoo.com/group/rest-discuss;_ylc=X3oDMTJlb2pzdTM0BF9TAzk3M...
MARKETPLACE
Stay on top of your group activity without leaving the page you're on -
Get the Yahoo! Toolbar now.
<
http://us.ard.yahoo.com/SIG=15oq80ha6/M=493064.13983314.13965207.13298430...
------------------------------------------------------------------------
Welcome to Mom Connection! Share stories, news and more with moms like
you.
<
http://us.ard.yahoo.com/SIG=15om2cahc/M=493064.13814537.13965224.10835568...
------------------------------------------------------------------------
Hobbies & Activities Zone: Find others who share your passions! Explore
new interests.
<
http://us.ard.yahoo.com/SIG=15o8vk54s/M=493064.14012770.13963757.13298430...
Yahoo! Groups
<
http://groups.yahoo.com/;_ylc=X3oDMTJkY3NnY2kzBF9TAzk3MzU5NzE0BGdycElkAzQ...
Switch to: Text-Only
<mailto:rest-discuss-traditional@yahoogroups.com?subject=Change Delivery
Format: Traditional>, Daily Digest
<mailto:rest-discuss-digest@yahoogroups.com?subject=Email Delivery:
Digest> • Unsubscribe
<mailto:rest-discuss-unsubscribe@yahoogroups.com?subject=Unsubscribe> •
Terms of Use <
http://docs.yahoo.com/info/terms/>
.
__,_._,___