I have the following domain specs:
A historic read only list of items that were published and a currently published item (if any) and an optional draft item (if any).
I thought of the following design:
Publicly accessible:
GET /items
# Returns list of items excluding optional draft
GET /item/published
# returns currently published item
Restricted access to an editor:
PUT /item/published
# update published item
GET /item/draft
# returns current draft item
PUT /item/draft
# update draft item
PATCH /item/draft
{publish: true}
# publish draft item
# replaces /item/published with this draft and clears /item/draft
As you can see: I don't have a need to update historic items or return them individually, so they are not identified by an ID.
Is the above design in the spirit of REST, or are there serious flaws?
For instance:
- Is promoting
/item/draft
to/item/published
(and thereby simultaneously deleting its contents) byPATCH
ing it acceptable? - Is not using IDs to individually identify items acceptable?