> For the complete documentation index, see [llms.txt](https://ultimatewebsolutions.gitbook.io/qa-knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ultimatewebsolutions.gitbook.io/qa-knowledge-base/api-testing-with-python/what-is-api.md).

# What is API?

An API, or Application Programming Interface, is an interface that allows different software components or systems to communicate with each other. In a REST API, clients typically communicate with the server over HTTP using methods such as GET, POST, PUT, PATCH and DELETE.&#x20;

As a QA engineer, I validate the status codes, response data, schema, headers, authentication, error handling and business logic.

{% hint style="info" %}
An API is a waiter between two systems: you send a request, and the API brings back a response.
{% endhint %}

### Methods

| Method     | Purpose                 | Example             |
| ---------- | ----------------------- | ------------------- |
| **GET**    | Retrieve data           | Get a product       |
| **POST**   | Create something        | Create an order     |
| **PUT**    | Replace/update resource | Update a user       |
| **PATCH**  | Partially update        | Change user's email |
| **DELETE** | Delete something        | Delete a product    |

### Status Codes

* 200 OK → successful GET
* 201 Created → resource created
* 204 No Content → successful request, no response body
* 400 Bad Request → invalid request
* 401 Unauthorized → authentication required/failed
* 403 Forbidden → authenticated but not allowed
* 404 Not Found → resource doesn't exist
* 409 Conflict → conflict, e.g. duplicate resource
* 500 Internal Error → server-side error

### Usual Communication

Client\
│\
│ HTTP Request\
▼\
API / Backend\
│\
│ Database query\
▼\
Database\
│\
│ Data\
▼\
API / Backend\
│\
│ HTTP Response\
▼\
Client
