RESTful API Best Practices

This post covers best practices for building HTTP and RESTful APIs. Let’s start with the terms that we will use mostly:

  • The resource is a information that can be a singleton or a collection. E.g. /companies, /company and /employees are resources. Collections are set of resources, e.g. /companies collection resource is the collection of /company resource. /Company resource is a singleton resource. A resource may contain sub-collections such as /companies/{company_id}/departments and it can be followed by a singleton resource, e.g. /companies/{company_id}/departments/{department_id}.
  • Operations such as patch, put, update, delete, and post can be performed on these resources.
  • URL (Uniform Resource Locator) is a path.

Continue reading “RESTful API Best Practices”


HTTP Cache Headers

HTTP caching can speed up web applications. It’s standardized and well implemented in all modern browsers and results in a lower latency app and improved responsiveness.

HTTP caching occurs when an item is fully cached for faster retrieval the next time the resource is required. The browser may choose to not contact the server at all and simply use its own local copies of web resources. There are many cache headers such as “Cache-Control”, “Expires”, “Last-Modified” and “ETag”.

Continue reading “HTTP Cache Headers”