Understand API's in less than 3 minutes

A quick overview of what an API is & what different types exist

Rob Johnson

by Rob Johnson

Mar 28, 2022

#draft

"API" may be one of those acronyms where it is said more than it is understood. This quick overview is intended to help anyone who is fairly new to API's get a quick grasp of what an API is and their different variants.

At a basic level, an API (Application Programming Interface) is a method of passing information into a program, to get a desired result back. A simple example of this is typing a math problem into a calculator.

Request: 2+2=
Response: 4

There is a certain way you write the request, and you have an expectation of how the response will look. "Four" (string) would technically be a correct response to the above question, although not the format you’d expect.

response: 4       //integer
response: 'Four'  //string
response: '4'     //string

Usually each request is made to a certain endpoint like https://domain.com/directory/filename and you POST parameters to the endpoint such as a start date, an end date or an ID of some kind. The endpoint is programmed to expect these parameters and will return the results in an expected/documented format.

The following endpoint call could be used to get all of the sales in January 2022 for a product with an ID of 123.

https://domain.com/sales/product?product_id=123&date_start=2022-01-01&date_end=2022-01-31

The response could return all the rows for each sale of product 123, customer names, purchase dates, discounts etc.

Need an answer to another question? Adapt the endpoint logic or create another endpoint.

Different API variants

  1. SOAP APIs (Simple Object Access Protocol): An XML-based protocol that is good for transferring a lot of information at once.
  2. REST APIs (Representational State Transfer): A stateless protocol which doesn't require server-side sessions
  3. GraphQL (Graphical Query Language):