Hi Diogo, great post, as usual. About the order cancellation, POST /order/123/cancellation, IMHO it looks like RPC.

If we’d do it in a RESTful way it would be a PATCH /orders/123 … however it’s not very intuitive, and different consumers could cancel an order in a different way, example: one consumer would update the field status to Canceled, other would call it Terminated, other would update more than one field. The business rule is not very clear here.

Doing it in a RPC style, it looks like more as a command, we can hide business details by calling it, as you suggested, POST /order/123/cancellation or cancel or something similar. So, it’s a business command (yeah, let’s call it business command, just invented it :P) hiding the business details behind the cancellation, so any consumer will always do the cancellation on the same way.

We can even link it to HATEOAS, it’s about the actions for this resource … following this line of thinking, are these actions (we can link to commands in this case) ALL RPC style?

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store