I would probably solve it using PUT / DELETE or POST / DELETE on a nested "switch resource". It may not be 100% completely soothing, but certainly light enough to understand.
PUT or POST /articles/:id/published # Toggle published ON DELETE /articles/:id/published # Toggle published OFF GET /articles/:id/published
It may seem a little strange, but it is technically RESTful.
Update: Perhaps a more natural approach might be:
PUT or POST /articles/:id/published Data: { state: true/false }
You can also use the verb PATCH with an actual article, which I assume has a published property:
PATCH /articles/:id { published: true/false }
Because all the cool REST kids use PATCH these days.
Chris nicola
source share