Is it restful to have verbs on the HTTP path instead of the HTTP method?

by brunoais   Last Updated February 16, 2018 15:05 PM

I've encountered API that tell as being "restful" but then I see resources with verbs instead of reserving those said verbs to the METHOD. Here's some (paths shortened so only the relevant method and path parts are shown):

  1. POST /things/84/lock
  2. POST /things/84/unlock
  3. POST /things/84/edit
  4. POST /things/prepend (Adding to the beginning of the ordered collection)

Why doesn't it make sense to do instead:

  1. LOCK /things/84
  2. UNLOCK /things/84
  3. PATCH /things/84 or EDIT /things/84 (I prefer the first one)
  4. PREFIX /things/prepend or PREPEND /things/prepend

I've only been told again and again that this is not restful because it must only use GET, POST, PUT, DELETE and PATCH to remain restful.

What logical explanation exists for having verbs in the path section of the URL for restful API?

Notes:

  1. I can't show you real life examples so I won't be pointing fingers at anybody.
  2. As for proxy limitations excuse I've been experiencing. It was valid while no workaround existed. Nowadays, most modern frameworks have mechanisms to allow method override using query variables or headers (with de-facto standards, even).


Related Questions


Including aggregate data in REST response in DDD

Updated February 16, 2018 11:05 AM