alphagov/rummager — pull request #234 by rboulton (2014-05-28 11:51:47+00:00)
Title: Change get and delete endpoints to accept a type

GET /documents/a-slug
DELETE /documents/a-slug

becomes

GET /documents/edition/a-slug
DELETE /documents/edition/a-slug

Before this PR, get and delete take a "link" parameter. "get" actually
works internally by looking up the document by the its id, whereas
"delete" works by deleting all documents with the given value in the
link field. This only works if the link field is equal to the id. This
isn't actually true; recommended links have no value in the link field,
and best bets don't even have a link field.

Instead, we're going to change the get and delete endpoints to accept
paths of the form "type/id". Currently, the only types that external
apps will ever send here are "edition" and "best_bet", so for the
purposes of the migration, we only support those two types. If the
supplied path doesn't start with one of those two types, assume it's an
edition type.

One this is merged, we'll update Rummageable to always send the type
when deleting documents
(https://github.com/alphagov/rummageable/pull/18) and change any calls
to the "get" endpoint similarly (if there are any). Finally, we'll
remove the support for omitting the "type" part.