Because everything is not a “resource” on our drone platform, we were tired of maintaining our RESTFul API.
I’ll talk about the pros and cons of designing an API following the action pattern. Here are a few (- is a con, + is a pro) :
– it is not usual… (we have to deal with developer frustration :)
– there are much more API routes than for RESTFul API (/pet becomes /create-pet, /delete-pet, /update-pet…)
+ it is easier to apply a specific authorization policy on an action (no need to check the content of the request : the route is allowed or not)
+ it’s easier to add a new feature, and not trying to make it fit to the RESTFul principles (especially if more than one resource is involved in this operation)
+ we don’t have to remember all the RESTFul-related status codes. If it’s ok, it’s 200. For every other applicative error, we use the same status code, and maintain a list of error keywords.
+ no more PUT, DEL, UPDATE headaches : we use only POST and GET
+ and more ;)
October 22, 2019 13:20