REST API

박상훈·2022년 4월 26일
0
post-thumbnail

REST API 코드 : 깃헙

API


Application Programming Interface

REST


REpresentational State Transfer
인터넷 상의 시스템 간의 상호 운용성(interoperability) 을 제공하는 방법중 하나
시스템 제각각의 독립적인 진화를 보장하기 위한 방법
REST API : REST 아키텍처 스타일을 따르는 API

REST 아키텍처 스타일

Client-Server
Stateless
Cache
Uniform Interface
Layered System
Code On Demand(optional)

Uniform Interface

Identification of resources
manipulation of resources through representations
self-descrive messages
HATEOAS(Hypermedia as the engine of application state)

self-descrive messages

메시지 스스로 메시지에 대한 설명이 가능해야 한다
서버가 변해서 메시지가 변해도 클라이언트는 그 메시지를 보고 해석이 가능하다
확장 가능한 커뮤니케이션

self-descrive messages 해결 2가지 방법

미디어 타입을 정의하고 IANA 에 등록하고 그 미디어 타입을 리소스 리턴할 때 Content-type 으로 사용
profile 링크 헤더 추가

HATEOAS

하이퍼미디어(링크) 를 통해 어플리케이션 상태 변화가 가능해야 한다
링크 정보를 동적으로 바꿀 수 있다(versioning 이 필요 없다)

HATEOAS 해결 방법

데이터에 링크 제공(HAL : Hypertext Application Language)

profile
엔지니어

0개의 댓글