reading-notes

Reading 7 - APIs

Source: API Best Design Practices

Q1 What does REST stand for?

Representational State Transfer

Q2 REST APIs are designed around a __.

Resources (Any kind of object, data, or service that can be accessed by a client)

Q3 What is an identifier of a resource? Give an example.

An identifier of a resource is a URI that uniquely identifies a resource.

An example might be:

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

Q4 What are the most common HTTP verbs?

GET, POST, PUT, PATCH, and DELETE

Q5 What should the URIs be based on?

The URIs should be based on nouns (the resource) as opposed to verbs (the operations on the resource)

Q6 Give an example of a good URI.

https://adventure-works.com/orders

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

If a web API is “chatty”, it requires multiple requests to perform a single tast. This is a bad thing because it leads to more API calls, which slows down the servers.

Q8 What status code does a successful GET request return?

200 (OK)

Q9 What status code does an unsuccessful GET request return?

404 (Not Found) if the resource cannot be located

204 (No Content) if the request was fulfilled buy there is no response body included in the HTTP response (for example, a search request with no matches)

Q10 What status code does a successful POST request return?

201 (Created) if it creates a new resource

200 (OK) if it does some processing but does not create a new resource.

204 (No Content) if there is no result to return

Q11 What status code does a successful DELETE request return?

204 (No Content)

Things I want to learn more about

What are APIs that are not considered RESTful, and what do these look like?