Class 08 Notes
API Design Best Practices
-
REST stands for Representational State Transfer.
-
REST APIs are designed around resources. This can be objects, data or services.
-
A resource identifier is a unique URL to this resource.
-
The most common HTTP verbs are GET, POST, PUT, PATCH, and DELETE.
-
URLs should be based on,
-
https://adventure-works.com/orders is an example of a good URL.
-
Having a ‘chatty’ API means that it takes more than one call to get the information you requested from that API. It is best to avoid having a chatty API.
-
A successful GET returns the code 200 OK.
-
An unsuccessful GET returns 404 ‘not found’.
-
A successful POST returns code 201.
-
A successful DELETE returns code 204.