REST APIs

Created at

This note contains general information and styles I like to follow when designing REST (Web) APIs.

  • Use the plural for resource routes. For example the path to retrieve the resource note should be /notes and not /note. To get a single note use /notes/123 where 123 is the id of the note.
  • Use HTTP methods to chose what to do:
    • GET = Retrieve state of a resource
    • POST = Add a new resource
    • PUT = Update a resource
    • DELETE = Delete a resource
  • Pass values that may contain file paths as query parameters and not as part of the URL segment. I learned this the hard way‚Ķmultiple times.
  • Describe and document your endpoints.