-
REST API에 대해서study 2020. 11. 24. 21:01반응형
REST API 설명에 앞서, 일단 API는 컴퓨터의 기능을 실행시키는 방법을 의미한다.
가령 'Hello World!'를 출력한다고 했을 때,
python에서는
print('Hello Wolrd!');
javascript에서는
document.write('Hello World!');
와 같이 표현할 것이다. 이때 print, document.write와 같은 하나하나 들을 API라고 할 수 있는 것이다.
그렇다면 REST API는 무엇일까?
사전적 정의를 찾아보면 'an architectural style for an application program interface (API) that uses HTTP requests to access and use data. That data can be used to GET, PUT, POST and DELETE data types, which refers to the reading, updating, creating and deleting of operations concerning resources. An API for a website is code that allows two software programs to communicate with each other' 라고 나와있는데,
HTTP 프로토콜을 사용하여 데이터를 액세스하거나 사용하며, GET, PUT, POST, DELETE로 읽기, 수정, 생성, 삭제를 할 수 있는 아키텍처 스타일이다. 웹에서의 API는 두개의 소프트웨어 프로그램이 서로 통신할 수 있는 코드이다ㅡ라고 나와있는데 어려워 보이지만 우리는 평소에도 주로 사용하고 있는 기술이다.
예를 들면 카카오나 facebook에서 제공하는 API 들을 사용한적이 있을 것이다. 이처럼 다른 컴퓨터의 코드를 가져다가 실행시키는 것으로 간단하게 이해할 수 있을 것 같다.
그럼 어떻게 통신을 할까?
정보를 가공할 때 리소스는 결국 4가지로 나눠진다. C R U D가 그것들인데,
Create(생성) - post
Read(읽기) - get
Update(수정) - put | patch
Delete(삭제) - delete
와 같은 메소드로 데이터를 주고 받고, 정보를 가공하며 결과는 응답코드로 돌려받는 HTTP의 본분을 활용하는 것이라고 설명할 수 있겠다.
참고 :
https://searchapparchitecture.techtarget.com/definition/RESTful-API
What is RESTful API (REST API)?
This definition explains the meaning of RESTful API, and how it works as a method of allowing communication between a web-based client and server that employs representational state transfer (REST) constraints.
searchapparchitecture.techtarget.com
반응형'study' 카테고리의 다른 글
Linux 관련 명령어 암기 (0) 2020.12.02 간단하게 React Hooks 사용해보기 (0) 2020.11.30 IT 신입 개발자 면접 대비 질문들(실무, 개념) (0) 2020.11.12 2020 리액트 개발자 로드맵(React Roadmap) (0) 2020.11.12 2020 프론트엔드 개발자 로드맵(Front-end Roadmap) (0) 2020.11.12