But what if the provider doesn't exist? 404? 200 with empty set? 200 with empty set and a warning? Something else?
Sent from my mobile
On 17 Jul 2015 17:43, "Jack Repenning" <repenni...@gmail.com> wrote:
>
> On Jul 16, 2015, at 3:28 PM, Greg Williamson <gwill...@zephyrhealth.com> wrote:
>>
>>
>> But what if the provider doesn't exist? 404? 200 with empty set? 200 with empty set and a warning? Something else?
>
>
> Mark me in the "404" column, too.
>
> In fact, why would you think otherwise? The REST notion is that /providers/123/publications names a resource (a collection resource, in this case). Is there some way in which the collection /providers/123/publications could meaningfully exist when the provider /providers/123 does not?
>
Technically, from a REST (or even www) point of view, the behaviour of a resource at one URL has no direct bearing on another; they are opaque identifiers and that applies even to these types of "nested" URLs.
REST pedantry aside: if the client is requesting a thing that's not there they should get a 404.
Cheers,
M
So what do you guys think about this URI:/publications?providerId=123where that provider doesn't exist. Still 404? Or is it 200 with an empty set? I think the latter, and perhaps this is what was distracting/confusing to me.
Follow on question:What should /providers/123/publications/456 return if1. /providers/123/publications returns 200 with [] but2. /publications/456 returns 200 with the publication ?Basically /publications/456 exists, but is not associated with /providers/123417? 404? 200 with []?I am inclined to go with 417 (though not strictly as per the HTTP spec, it indicates that the precondition of publication:456 being accessible via provider:123 failed). Don't have a strong opinion about this currently.