본문 바로가기

기록하기

RESTful API 설계 시 고려해야 할 사항

  • Consumer first
    • 개발자 입장보다는 소비자(사용자) 입장
    • 직관적으로 설계
  • Make best use of HTTP
    • Http의 장점을 최대한 살려서~
  • Request methods
    • GET
    • POST
    • PUT
    • DELETE
  • Response Status
    • 200
    • 404
    • 400
    • 201
    • 401
  • 참고글(성숙도 모델) Level2 단계에 맞춰서(특징을 잘 살려서)
  • 리소스 별로 알맞은 메서드, 상태코드 사용
  • No secure info in URI
    • 크리티컬 한 데이터 포함 X
  • Use plurals
    • prefer /users to /user
    • prefer /users/1 to /user/1
  • 제공하려는 데이터를 복수형태로 권장
  • 특정한 리소스를 지칭하고 싶을 때는 depth로 구분해서 사용
  • User nouns for resources
    • 동사형태보다는 명사형태로~
  • For exceptions
    • define a consistent approach
      • /search
      • PUT /gists/{id}/star
      • DELETE /gists/{id}/star
  • 일관된 엔드포인트 사용 권장

참고 https://restfulapi.net/richardson-maturity-model/

 

Richardson Maturity Model - REST API Tutorial

The Richardson Maturity Model is a framework for evaluating the maturity of web services in terms of their adherence to RESTful principles.

restfulapi.net

 

'기록하기' 카테고리의 다른 글

Swagger controller 설정  (0) 2024.03.28
Docker container 로그 확인하기  (0) 2024.03.03
DB 정하기  (0) 2024.02.23
면접 복기하기(2)  (0) 2024.01.24
모의면접 복기하기  (1) 2024.01.21