A REST API, or RESTful API, is a web interface that lets systems communicate over HTTP using standard methods such as GET, POST, PUT and DELETE to work with resources at defined endpoints. Responses usually come back as JSON with an HTTP status code.
Why it matters: Applications, services and databases are often loosely coupled through REST APIs. The API forms a contract with its consumers: they expect consistent endpoints, parameters, request bodies, status codes and data. Any unexpected change can break the applications that depend on it.
In practice: API testing sends requests to the live API and checks the responses, including status codes, headers, cookies, JSON content and the shape of the data. Tests are usually automated and run in continuous integration, so problems are caught before consumers see them.
Examples:
- Testing that an endpoint returns the right status code, headers and JSON for valid and invalid requests.
- Checking that a new release still accepts the request bodies existing consumers send.
Common pitfalls:
- Testing only the happy path, and missing how the API handles bad input.
- Changing a response's structure without realising which consumers rely on it.
What's the difference between REST and GraphQL? REST exposes fixed endpoints for each resource. GraphQL uses a single endpoint where the client asks for exactly the data it needs.