YouTip LogoYouTip

RESTful API Design Principles

REST API Design

GET    /api/users          # list all
GET    /api/users/123      # get one
POST   /api/users          # create
PUT    /api/users/123      # update
DELETE /api/users/123      # delete

Response Format

{"status": "success", "data": {...}}
{"status": "error", "error": {"code": 404, "message": "Not found"}}

Summary

  • Use nouns for resources, HTTP methods for actions
  • Return consistent response format
← ECharts Tutorial - Getting StaData Structures - Hash Tables β†’