Cheatsheets

Personal collection of cheatsheets.

HTTP

Hypertext Transfer Protocol (HTTP) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems that lay the foundation of data communication for the World Wide Web.

Index

Methods

HTTP methods (verbs) indicate the desired action to be performed on the identified resource.

Headers

HTTP headers are a list of strings sent and received by both the client program and server on every HTTP request and response.

Authorization

Authorization is used to provide credentials that authenticate a user agent with a server, allowing access to protected resources.

Authorization: Basic <base64(username:password)>
Authorization: Bearer <token>
Authorization: ApiKey <base64(api_key:secret_key)>

Content-Disposition

Content-Disposition describes what the receiver should do with the content, should it be displayed in the browser or downloaded as a file.

Content-Disposition: [inline|attachment]; filename="[filename]"

This header is commonly used with a HTML anchor element to download a file from a URL.

const link = document.createElement('a');
link.target = '_blank';
link.href = url;
link.download = filename;
link.click();

REST

Representational State Transfer (REST) is a software architectural style that was created to guide the design and development of the architecture for the World Wide Web. It has been employed throughout the software industry to create stateless, idempotent and reliable Web-based applications and HTTP-based APIs.

/customers/{id}
/customers/{id}/orders
/store/items/{id}
/store/inventory-management
/v1/customers/{id}
/v2/customers/{id}
/customers?lastname=Smith&age=63
/customers?fields=id,age
/customers?sort=lastname,age
/customers?limit=50
/customers?start=0&limit=50