launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #07388
Re: Breaking backward incompatibility with exception mapping
On 11-06-16 09:24 AM, Aaron Bentley wrote:
> On 11-06-15 06:05 PM, Francis J. Lacoste wrote:
>> We have a bunch of exceptions that are mapped to 400 but should really
>> be mapped to 404. NoSuchPPA, NoSuchDistroSeries, NoSuchBranch, etc.
>
> More precision is nice, but I'm a bit worried that 404 may be too
> contextual. I interpret 404 as "The resource requested at this URL does
> not exist". So if I'm retrieving a branch that doesn't exist, a 404
> seems like a reasonable status code. But if I'm supplying a branch that
> doesn't exist as a POST or GET parameter to another URL, e.g. to set a
> series branch, 404 suggests that the URL (i.e. the series), not the
> branch parameter, doesn't exist.
>
Technically, the URL resource includes the parameters. So 404 makes
sense in that context:
GET /ubuntu?ws:op=getSeries&name_or_version=oneiric -> 200
GET /ubuntu?ws:op=getSeries&name_or_version=foobar -> 404
From an API point of view, I think a NotFound error is less surprising
than a BadRequest. In both cases though, the error message makes it
clear what was the problem.
--
Francis J. Lacoste
francis.lacoste@xxxxxxxxxxxxx
Attachment:
signature.asc
Description: OpenPGP digital signature
References