I started learning about REST APIs designed around the HATEOAS principle and
I am trying to picture what it would be like to use it in production.
My main concern is CRUD operations on entities that are part of relations, be they one-to-one, one-to-many, many-to-many or many-to-one. Following what I understand about HATEOAS, it seems that creating/updating an entity and assigning a relationship to it are designed to be two separate calls to the REST API.
What if a clients connection breaks in between the two calls?
Doesnt this present a problem with data consistency?
For example, imagine a webshop application that allows the user to create reviews for products and assign a score. Besides the rating itself, a review entity would have a user (the creator) and a product, both as one-to-many relationships.
In this example, the client would make one call to create the review entity itself, one call to assign the user to that review and another call to assign a product to that review. In between any of those calls, the user client could crash or be cut of from the network. This would leave us with a review with no creator or worse, a review that does not belong to any product and is just cluttering our production DB.
Please write your thoughts and let me know if I misunderstood the concept.