ReadingNotes

APIs

About Api design practices

API best design practices

Questions

  1. REST stands for Representational State Transfer.
  2. REST APIs are designed around resources, which can be any type of object, data, or service that can be accessed by the client.
  3. An identifier of a resource is a URI (Uniform Resource Identifier) that uniquely identifies a particular resource. For example, “https://example.com/customers/123” could be the URI of a customer resource, where “123” is the identifier of a specific customer.
  4. The most common HTTP verbs used in RESTful API are GET, POST, PUT, DELETE.
  5. URIs should be based on the resources they identify, rather than on the actions that can be performed on those resources. This is because RESTful APIs are designed to be resource-oriented, not action-oriented.
  6. A good URI should be descriptive, easy to read and understand, and should reflect the structure of the resource it identifies. For example, a good URI for a blog post resource might be “https://example.com/posts/1234” where “1234” is the ID of the blog post.
  7. A ‘chatty’ web API is one that requires multiple requests to retrieve or update a single resource. This is generally considered a bad thing because it can result in slower performance, higher network latency, and increased load on the server.
  8. A successful GET request returns a status code of 200 OK, along with the requested resource in the response body.
  9. An unsuccessful GET request returns a status code of 404 Not Found if the requested resource is not found, or a 401 Unauthorized if the client is not authorized to access the resource.
  10. A successful POST request returns a status code of 201 Created, along with a Location header that contains the URI of the newly created resource.
  11. A successful DELETE request returns a status code of 204 No Content, indicating that the resource has been successfully deleted.

Things i want to know more about