관리 메뉴

웹개발 블로그

Rest API란? + 설계 예시 본문

◆HTTP

Rest API란? + 설계 예시

쿠키린 2023. 5. 2. 09:18

https://khj93.tistory.com/entry/%EB%84%A4%ED%8A%B8%EC%9B%8C%ED%81%AC-REST-API%EB%9E%80-REST-RESTful%EC%9D%B4%EB%9E%80

 

[네트워크] REST API란? REST, RESTful이란?

REST API란 REST를 기반으로 만들어진 API를 의미합니다. REST API를 알기 위해 REST부터 알아보도록 하겠습니다. REST란? REST(Representational State Transfer)의 약자로 자원을 이름으로 구분하여 해당 자원의 상

khj93.tistory.com

REST API 설계 예시

1. URI는 동사보다는 명사를, 대문자보다는 소문자를 사용하여야 한다.

Bad Example http://khj93.com/Running/
Good Example  http://khj93.com/run/  

 

2. 마지막에 슬래시 (/)를 포함하지 않는다.

Bad Example http://khj93.com/test/  
Good Example  http://khj93.com/test

 

3. 언더바 대신 하이폰을 사용한다.

Bad Example http://khj93.com/test_blog
Good Example  http://khj93.com/test-blog  

 

4. 파일확장자는 URI에 포함하지 않는다.

Bad Example http://khj93.com/photo.jpg  
Good Example  http://khj93.com/photo  

 

5. 행위를 포함하지 않는다.

Bad Example http://khj93.com/delete-post/1  
Good Example  http://khj93.com/post/1  

'◆HTTP' 카테고리의 다른 글

[서블릿] HTTP 요청  (0) 2023.02.14
[HTTP] HTTP Response 시 Header 구조  (0) 2023.02.09
[HTTP] 쿠키와 세션에 대해서 + 차이점  (0) 2023.02.09
[HTTP] HTTP Request 시 Header 구조  (0) 2023.02.09
[HTTP] 프로토콜 구조  (0) 2023.02.09