API Cheet Sheet
API Cheet Sheet
CheatSheet
In this Cheatsheet, we will cover the basics of API. We will provide
examples to help you understand how API’s work and how to use
them in your own web development projects. Whether you are a
beginner or an experienced developer, this PDF can serve as a
useful reference guide.
API
An API, or Application Programming Interface, is a set of rules and
protocols for building and interacting with software applications.
It allows different software systems to communicate with each
other, enabling them to share data and functionality. This allows
developers to access the functionality of a certain software
application or system without having to understand its underlying
code or implementation.
An example of an API is the Facebook API, which allows
developers to access and interact with the functionality of the
Facebook platform, such as posting status updates, retrieving
user information, and managing ad campaigns. Another example
is the Google Maps API, which allows developers to embed maps
and location-based functionality in their own websites and apps.
2|Page
The server responds with the requested data, which the API then
forwards to the initial requesting application. This process of
requests and responses all happens through the API. Unlike user
interfaces which are designed for human use, APIs are designed
for use by computers or applications.
3|Page
A request generally consists:
• An HTTP verb, which defines what kind of operation to
perform.
• A header, which allows the client to pass along information
about the request.
• A path to a resource.
• An optional message body containing data.
CRUD stands for Create, Read, Update, and Delete, which are the
four basic operations that can be performed on data in a
database. These operations are often used to interact with
databases through APIs (Application Programming Interfaces).
HTTP Verbs
5|Page
• PUT vs PATCH: PUT method uses the request URI to supply a
modified version of the requested resource which replaces
the original version of the resource, whereas the PATCH
method supplies a set of instructions to modify the resource.
These verbs are part of the HTTP protocol, and are commonly used
in RESTful (Representational State Transfer) APIs, which are built
on top of the HTTP protocol and are designed to be easily
consumed by web and mobile applications.
6|Page
HTTP Status Codes
Standard Classes:
• 100: Continue.
• 101: Switching Protocols.
• 102: Processing.
• 103: Early Hints.
7|Page
2xx: Successful responses
It indicates that the action requested by the client was received,
understood, and accepted.
• 200: OK.
• 201: Created.
• 202: Accepted.
• 203: Non-Authoritative Information.
• 204: No Content.
8|Page
4xx: Client error responses
This status code is intended for situations in which the error seems
to have been caused by the client.
These are just a few examples of the many HTTP status codes that
can be returned by an API. It's important to understand the
meaning of each code and to handle them appropriately in the
client application. The HTTP status codes are standardized and are
used as a way for the server to communicate with the client about
the outcome of a request.
9|Page