Notes on APIs
API Design Best Practices
- What does REST stand for?
Representational State Transfer.
- REST APIs are designed around a __.
resources, which are objects, data, or services that a client can access.
- What is an identifer of a resource? Give an example.
A URI that uniquely specifies the particular resource. For instance, the Cat article on Yamapedia (Yamas Wikipedia) could have an identifier of:
https://www.yamapedia.com/cat
- What are the most common HTTP verbs?
GET, POST, PUT, PATCH, DELETE.
- What should the URIs be based on?
The nouns that describe the specific resource (rather than the verbs that occurring regarding the resource).
- Give an example of a good URI.
Good example: https://www.yamapedia.com/cat-article Bad example: https://www.yamapedia.com/click-cat-pic
- What does it mean to have a ‘chatty’ web API? Is this a good or a bad thing?
A chatty web API is a bad thing because it can overload the server with multiple requests for data that could have been consolidated into a single request per user.
- What status code does a successful GET request return?
200 (OK)
- What status code does an unsuccessful GET request return?
404 (Not Found)
- What status code does a successful POST request return?
201 (Created)
- What status code does a successful DELETE request return?
204 (No Content)
Things I want to know more about
Look forward to learning more about filtering and paginating data, because that seems like it’ll be very useful.