Code 301 Class 08 Reading Notes
API Design Best Practices
- What does REST stand for? Representational State Transfer
- REST APIs are designed around a resouce which are any kind of object, data, or service that can be access by the client.
- What is an identifer of a resource? Give an example. a URI that inquely identifies that resource
https://adventure-works.com/orders/1
- What are the most common HTTP verbs?
GET, POST, PUT, PATCH
, ANDDELETE
- What should the URIs be based on? Nouns, the resource.
- Give an example of a good URI.
https://adventure-works.com/orders
- What does it mean to have a ‘chatty’ web API? Is this a good or a bad thing? Web APIs that expose a large number of small resources. It’s good to have a balance between small and large, small enough that there isn’t a large load, and not to large that you run the risk of increased latency of a request.
- What status code does a successful GET request return? HTTP status code 200 (OK)
- What status code does an unsuccessful GET request return? HTTP status code 404 (Not Found)
- What status code does a successful POST request return? HTTP status code 201 (CREATED)
- What status code does a successful DELETE request return? HTTP status code 204 (Not Created)
Things I want to know more about
I’m getting the verbs and the codes behind the verbs. But would love to be able to put the code in a meaningful way where it’s posted, so it can be patched and not deleted.