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@mac.com To: Jørn Wildt jw@fjeldgruppen.dk CC: Rest List rest-discuss@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@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=X3oDMTJxMzU2ZjZrBF9TAzk3MzU5NzE0BGdycElkAzQzMTkyNTUEZ3Jwc3BJZAMxNzA1NzAxMDE0BG1zZ0lkAzE1MzAwBHNlYwNmdHIEc2xrA3JwbHkEc3RpbWUDMTI3MTU4MTA2Ng--?act=reply&messageNum=15300
| Start a New Topic http://groups.yahoo.com/group/rest-discuss/post;_ylc=X3oDMTJlcmZmMWtlBF9TAzk3MzU5NzE0BGdycElkAzQzMTkyNTUEZ3Jwc3BJZAMxNzA1NzAxMDE0BHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTI3MTU4MTA2Ng--
(3) Recent Activity:
* New Members
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/D=groups/S=1705701014:MKP1/Y=YAHOO/EXP=1271588266/L=750ff398-4ac8-11df-ae49-2f7f8f53f4e8/B=wcb2BdGDJHQ-/J=1271581066241542/K=P9stfYreX4w8K74gW1FPig/A=6060255/R=0/SIG=1194m4keh/*http://us.toolbar.yahoo.com/?.cpdl=grpj
------------------------------------------------------------------------
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/D=groups/S=1705701014:MKP1/Y=YAHOO/EXP=1271588266/L=750ff398-4ac8-11df-ae49-2f7f8f53f4e8/B=wsb2BdGDJHQ-/J=1271581066241542/K=P9stfYreX4w8K74gW1FPig/A=6042764/R=0/SIG=11jbo19n3/*http://advision.webevents.yahoo.com/momconnection
------------------------------------------------------------------------
Hobbies & Activities Zone: Find others who share your passions! Explore new interests. http://us.ard.yahoo.com/SIG=15o8vk54s/M=493064.14012770.13963757.13298430/D=groups/S=1705701014:MKP1/Y=YAHOO/EXP=1271588266/L=750ff398-4ac8-11df-ae49-2f7f8f53f4e8/B=w8b2BdGDJHQ-/J=1271581066241542/K=P9stfYreX4w8K74gW1FPig/A=6015306/R=0/SIG=11vlkvigg/*http://advision.webevents.yahoo.com/hobbiesandactivitieszone/
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/ .
__,_._,___
candlepin@lists.stg.fedorahosted.org