API Design Best Practices

My reading notes for Code Fellows


API Design Best Practices

What does REST stand for? Representational State Transfer (REST)

REST APIs are designed around a ____. REST APIs are designed around resources, which are any kind of object, data, or service that can be accessed by the client.

What is an identifier of a resource? Give an example. A resource has an identifier, which is a URI that uniquely identifies that resource. For example, the URI for a particular customer order might be:

https://adventure-works.com/orders/1

What are the most common HTTP verbs? GET, POST, PUT, PATCH, and DELETE.

What should the URIs be based on? When possible, resource URIs should be based on nouns (the resource) and not verbs (the operations on the resource).

Give an example of a good URI. https://adventure-works.com/orders // Good

https://adventure-works.com/create-order // Avoid

What does it mean to have a ‘chatty’ web API? Is this a good or a bad thing? Chatty is a bad thing. It basically means that the API has to send multiple pieces of information rather than it being available all at once.

What status code does a successful GET request return? 200 (OK)

What status code does an unsuccessful GET request return? 204 (No Content)

What status code does a successful POST request return? 201 (Created)

What status code does a successful DELETE request return? 204 (No Content)