What is an API?

General Information

Application Programming Interfaces (APIs) allow applications/servers to connect to each other (Figure 1). APIs are predictable, i.e., they follow a set structure and they usually return JSON data. APIs differ from traditional websites as the former use routing and the latter use files (Figure 2).

Figure 1: Restaurant analogy (image taken from here).

Figure 2: Traditional website directories vs. API endpoints (image taken from here).

API Types

Different API types (image taken from here, originally sourced from here).

There are also Batched APIs: multiple RESTful or GraphQL API requests embdeddded into a single piece of JSON. These are common in mobile applications.

RESTful APIs

RESTful (REpresentational State Transfer) APIs are stateless, i.e., each request includes all required information that the server needs. In layman's terms this is how they work:

  1. The client makes a request for some specific data.

  2. The server creates an object based on this request.

  3. The server sends the "state" of this object as a response to the client.

The CRUD operations of a RESTful API (image taken from here).

Testing Stages

The stages of API testing (image taken from here).

Last updated

Was this helpful?