Re: Modeling conditional update based on existence of a dependent resource

Dan Haywood <[email protected]>
Newsgroups gmane.comp.web.services.rest
Message-ID <CALJOYLE46gib1RW8o_w-8sMpE8ondghajTzgEwWzLPqa2jnrfg@mail.gmail.com>
On 3 July 2012 12:38, Mike Kelly <[email protected]> wrote:

> **
>
>
> On Tue, Jul 3, 2012 at 12:33 PM, Shaunak Kashyap <[email protected]>wrote:
>
>> **
>>
>>
>>
>> Using HTTP, if resource A exists, I would like PUT /uri/for/resource/B to
>> succeed. If resource B does not exist, I would like the same PUT request to
>> fail, responding with a status code that indicates to the client that
>> resource A does not exist. So what is a good status code to respond with in
>> the failure case?
>>
>
> Would 404 not suffice here?
>
>

But the resource being put to DOES exist, so 404 doesn't make sense.

To me it's more like a validation error, so consider 422 ("unprocesssable
entity").

Dan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.