Link Search Menu Expand Document

API Design Best Practices

What does REST stand for?

  • Representational State Transfer

REST APIs are designed around __?

  • Resources

What is an identifier of a resource? Give an example

  • This is a URL that uniquely identifies the target resource).

  • An example given from the reading would be a customer order

What are the most common HTTP verbs?

  • GET
  • POST
  • PUT
  • PATCH
  • DELETE

What should the URIs be based on?

  • URIs should be based on nouns

Give an example of a good URI

      userinfo       host      port
          ┌──┴───┐ ┌──────┴──────┐ ┌┴┐
  https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top
  └─┬─┘   └───────────┬──────────────┘└───────┬───────┘ └───────────┬─────────────┘ └┬┘
  scheme          authority                  path                 query           fragment

wikipedia URI

What does it mean to have a ‘chatty’ web API? Is this a good or a bad thing?

  • These are web APIs that expose a large number of small resources and should be avoided.

What status code does a successful GET request return?

  • 200

What status code does an unsuccessful GET request return?

  • 400

What status code does a successful POST request return?

  • 201 (created) or 200 (ok)

What status code does a successful DELETE request return?

  • 204

Bookmark and Review

RegExr

Regex Tutorial

Regex 101