REST API ?

 

REST의 원리를 따르는 API를 의미한다. REST API의 올바른 설계를 위해서는 다음과 같은 몇가지 규칙을 지키는 것이 도움이 된다.

 

 

REST API의 예시

 

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

Bad : http://newhendrick.com/Running
Good : http://newhendrick.com/run

 

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

Bad : http://newhendrick.com/run/
Good : http://newhendrick.com/run

 

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

Bad : http://newhendrick.com/good_blog
Good : http://newhendrick.com/good-blog

 

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

Bad : http://newhendrick.com/photo.jpg
Good : http://newhendrick.com/photo

 

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

Bad : http://newhendrick.com/delete-post/1
Good : http://newhendrick.com/post/1

'Backend > Spring Framework' 카테고리의 다른 글

[Spring] Swagger(스웨거) (1/2)  (0) 2022.07.28
[Spring] REST 예제  (0) 2022.07.26
[Spring] REST / RESTful  (0) 2022.07.25
[Spring] IoC (제어권 역전) 와 DI (의존성 주입)  (0) 2022.01.24
[Spring] @Transactional @@@@@  (0) 2022.01.21

+ Recent posts