API Design
API (Application Programming Interface) is a set of rules that allows different services to talk with each other.
Here are the 20 concepts to get started with API Design:
- Endpoint: A URL that represents a ‘resource’, such as a user or an order. Clients send requests to endpoints to read or modify data.
- HTTP Methods: Actions like GET, POST, PUT, PATCH, and DELETE. It defines what operation is performed on a resource.
- Request-Response: Communication pattern where a client sends a request… and server returns a response containing headers, a body, and a status code.
- Status Codes: Numeric codes (200, 404, 500) that tell the client if a request succeeded, failed, or needs extra action. Think of it as server “response indicator”.
- Authentication: Verifying the IDENTITY of a user, usually using credentials like passwords, API keys, or tokens.
- Authorization: Decide what an authenticated user can DO. For example, reading data or performing admin actions.
- Access Tokens: Short-lived credentials issued after authentication that clients include in requests to “prove” they have access rights.
- OAuth 2.0: An authorization framework that lets users grant limited access to their data ‘without’ sharing their passwords. Imagine delegated user access.
- Rate Limiting: A technique to restrict how many API requests a client can make in a given time window to PROTECT the system.
- Throttling: A technique that SLOWS down or temporarily blocks requests when usage exceeds allowed limits, instead of entirely rejecting them.
- Pagination: Split large datasets into smaller chunks to improve performance + reduce response size.
- Caching: Storing frequently accessed data so future requests can be served FASTER without recomputing or refetching it.
- Idempotency: A property where making the same request repeatedly yields the same result, essential for retries & reliability.
- Webhooks: A mechanism where the server “automatically” sends data to another system when an event happens,,, instead of waiting for polling.
- API Versioning: A strategy for managing ‘changes to an API’ over time without breaking existing clients.
- OpenAPI: A standard specification for describing APIs in a machine-readable format, often used to generate documentation and client code.
- REST vs GraphQL: Different API styles… REST exposes endpoints,,, while GraphQL allows clients to request exact data they need.
- API Gateway: A “single entry point” to route requests to various backend services. Plus, it handles concerns like authentication & rate limiting.
- Microservices: An architectural approach where an application is built as a set of small, independent services that communicate via APIs.
- Error Handling: A consistent way to return clear error messages and status codes so clients can understand & react to failures.