Validation of request entities

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Validation of request entities

Werner Donné

Hi,

In a versioning repository it may be required to validate the
request entity before updating a version. This can be as simple
as structural validation or application-specific validation
rules may be implemented.

When validation errors are found it is not sufficient to just
return a status-code. In order for the user to learn where
the problems exactly are, the repository should be able to
return the request entity with annotations about the errors.

A possible solution is to give the POST method similar additional
semantics as the PUT method. Its response entity could contain
the annotated document.

Regards,

Werner.
--
Werner Donné  --  Re
Engelbeekstraat 8
B-3300 Tienen
tel: (+32) 486 425803 e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Validation of request entities

Julian Reschke

Werner Donné wrote:

> Hi,
>
> In a versioning repository it may be required to validate the
> request entity before updating a version. This can be as simple
> as structural validation or application-specific validation
> rules may be implemented.
>
> When validation errors are found it is not sufficient to just
> return a status-code. In order for the user to learn where
> the problems exactly are, the repository should be able to
> return the request entity with annotations about the errors.
>
> A possible solution is to give the POST method similar additional
> semantics as the PUT method. Its response entity could contain
> the annotated document.

Why not do it with the PUT response body?

Best regards, Julian

Reply | Threaded
Open this post in threaded view
|

Re: Validation of request entities

Werner Donné

Julian Reschke wrote:

> Werner Donné wrote:
>> Hi,
>>
>> In a versioning repository it may be required to validate the
>> request entity before updating a version. This can be as simple
>> as structural validation or application-specific validation
>> rules may be implemented.
>>
>> When validation errors are found it is not sufficient to just
>> return a status-code. In order for the user to learn where
>> the problems exactly are, the repository should be able to
>> return the request entity with annotations about the errors.
>>
>> A possible solution is to give the POST method similar additional
>> semantics as the PUT method. Its response entity could contain
>> the annotated document.
>
> Why not do it with the PUT response body?

Because I don't think the PUT method is supposed to have a response
body. RFC 2616 says nothing about a response body in section 9.6,
while for methods that can have one it explains the conditions for
it.

>
> Best regards, Julian

Regards,

Werner.
--
Werner Donné  --  Re
Engelbeekstraat 8
B-3300 Tienen
tel: (+32) 486 425803 e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Validation of request entities

Julian Reschke

Werner Donné wrote:

>> Why not do it with the PUT response body?
>
> Because I don't think the PUT method is supposed to have a response
> body. RFC 2616 says nothing about a response body in section 9.6,
> while for methods that can have one it explains the conditions for
> it.
>
>> Best regards, Julian
>
> Regards,
>
> Werner.


Any method response can have a body, except for HEAD.

Best regards, Julian

Reply | Threaded
Open this post in threaded view
|

Re: Validation of request entities

Werner Donné

Indeed. The scenario I was referring to is described in section
10.4.10 of RFC 2616, the 409 status-code. Thank you.

Regards,

Werner.

Julian Reschke wrote:

> Werner Donné wrote:
>>> Why not do it with the PUT response body?
>>
>> Because I don't think the PUT method is supposed to have a response
>> body. RFC 2616 says nothing about a response body in section 9.6,
>> while for methods that can have one it explains the conditions for
>> it.
>>
>>> Best regards, Julian
>>
>> Regards,
>>
>> Werner.
>
>
> Any method response can have a body, except for HEAD.
>
> Best regards, Julian
>
>

--
Werner Donné  --  Re
Engelbeekstraat 8
B-3300 Tienen
tel: (+32) 486 425803 e-mail: [hidden email]