막연하게 get, post만 알고있던 rest에 대해서 자세히 알아보자.
그런 restAPI로 괜찮은가
라는 영상을 봤는데 아주 교과서적인 rest에 대해서 다루는것 같았다. rest아키텍쳐에 맞는 rest스러운 api를 다루도록 노력해보자
우선 잘 정리된 글이 있어 아래 게시글을 많이 참고하였고 이 글에는 핵심만 정리하였다
https://meetup.toast.com/posts/92
https://devuna.tistory.com/77
// 요청방식
GET http://goddaehee.tistory.com/168 HTTP/1.1
// 헤더 (데이터에대한 정보)
Host: goddaehee.tistory.com
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://goddaehee.tistory.com/
Accept-Encoding: gzip, deflate
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: menuEnabled=1;
//바디 (실제 데이터)
<!doctype html>
...
//서버상태
{name:"default, age:0"}
// {name:"ktw"} PUT 요청시
// 서버상태는 {name:"ktw", age:NULL}
// {name:"ktw"} PATCH 요청시
// 서버상태는 {name:"ktw", age:0}