What is HATEOAS and why is it important for my REST API?
HATEOAS stands for Hypertext As The Engine Of Application State. It means that hypertext should be used to find your way through the API. An example:
Apart from the fact that we have 100 dollars (US) in our account, we can see 4 options: deposit more money, withdraw money, transfer money to another account, or close our account. The “link”-tags allows us to find out the URLs that are needed for the specified actions. Now, let’s suppose we didn’t have 100 usd in the bank, but we actually are in the red:
Now we are 25 dollars in the red. Do you see that right now we have lost many of our options, and only depositing money is valid? As long as we are in the red, we cannot close our account, nor transfer or withdraw any money from the account. The hypertext is actually telling us what is allowed and what not: HATEOAS
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?