A situation arose in the work that does not fit well into the traditional REST: there is an entity (monetary transaction), which after creation can be updated only once (correctly completed or canceled). Those. The entity is processed as follows:
transaction [id=<uuid> state=pending] (волшебное обновляющее действие путем воздействия на API через HTTP) transaction [id=<uuid> state=completed] или transaction [id=<uuid> state=cancelled] Of course, I can declare a PUT controller that will catch the {"state": "completed"} format payload and apply it to the transaction if it has not yet been completed in one way or another. However, this approach seems to me frankly a crutch; it seems to me that PUT requests in the generally accepted understanding of REST should not be blocked by such complex validation rules. Is there a more beautiful solution inside the generally accepted vision of REST?
POST transaction/{uuid}/completeandPOST transaction/{uuid}/cancel? - Nofate ♦transaction/{uuid}resource into one state or another. Moreover, the transformation can still be a very real resource and run asynchronously. If you pick on a noun, it can be POSTtransaction/{uuid}/completionandPOST transaction/{uuid}/cancellation- Nofate ♦PUT, but withPATCH. - Nofate ♦