<aside> 💡 1. HATEOAS에 대한 이해 2. SpringBoot환경에서 Spring REST Docs를 이용한 API 문서화
</aside>
<aside> 💡 Spring Framework상에서 REST API 아키텍쳐 중 HATEOAS를 만족하는 API를 보다 간편하게 접근하기 위한 Spring진영의 Library
</aside>
Spring HATEOAS - Reference Documentation
<aside> 💡 HATEOAS : Hypermedia as the Engine of Application State REST API 아키텍쳐 컴포넌트중 하나로 Application Server와 Client Server 통신 간에 Hypermedia를 이용하여 동적으로 통신하는 개념
</aside>
즉, Appliation의 상태 변화에 따라 다음 상태로 전이 할 수 있는 Link 정보를 동적으로 통신하는 방법
**GET /accounts/12345 HTTP/1.1**
Host: bank.example.com
Accept: application/vnd.acme.account+json
다음과 같이 account_no가 12345인 Account를 조회하는 API를 호출한다고 가정하자.
**HTTP/1.1 200 OK**
Content-Type: application/vnd.acme.account+json
Content-Length: ...
{
"account": {
"account_number": 12345,
"balance": {
"currency": "usd",
"value": 100.00
},
"links": {
"deposit": "/accounts/12345/deposit",
"withdraw": "/accounts/12345/withdraw",
"transfer": "/accounts/12345/transfer",
"close": "/accounts/12345/close"
}
}
}
Application의 상태에 따라 API 응답에 deposit(예금), withdraw(출금), transfer(송금), close(정지) 등 Application이 다음 상태로 전이 가능한 Link 정보를 확인할 수 있다.