Reading
API Desgn 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.
Ex:
- 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?
- 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
- What does it mean to have a ‘chatty’ web API? Is this a good or a bad thing?
- The more requests, the bigger the load. Meaning ‘Chatty’
- What status code does a successful GET request return?
- GET retrieves a representation of the resource at the specified URI.
The body of the response message contains the details of the requested resource.
- What status code does an unsuccessful GET request return?
- If the server cannot match any of the media type(s) listed,
it should return HTTP status code 406 (Not Acceptable).
- What status code does a successful POST request return?
- POST creates a new resource at the specified URI. The body of the request
message provides the details of the new resource.
- What status code does a successful DELETE request return?
- Removes the resource at the specified URI.