API: complete guide
API in simple words, how REST works, GET/POST/PUT/DELETE methods, JSON, response codes, examples.
An API (Application Programming Interface) is a set of rules and protocols that allows software applications to communicate with each other. REST APIs are the most common way web services exchange data.
What is an API
REST (Representational State Transfer) uses HTTP methods on resources (URLs):
GET /users/123— get user dataPOST /users— create new userPUT /users/123— update userDELETE /users/123— delete user
What is REST API
- REST — HTTP-based, JSON, stateless. Most common
- GraphQL — query exactly what you need, single endpoint
- gRPC — binary protocol, faster than REST, used in microservices
- WebSocket — real-time bidirectional communication
- SOAP — XML-based, legacy, used in banking/enterprise
HTTP methods
- API Key — simple token in header:
X-API-Key: abc123 - OAuth 2.0 — "Login with Google/GitHub" — delegated authorization
- JWT Bearer —
Authorization: Bearer eyJhbG... - Basic Auth —
Authorization: Basic base64(user:pass)
JSON: data format
Rate limiting controls how many requests a client can make. Common headers: X-RateLimit-Limit, X-RateLimit-Remaining, Retry-After. Return 429 Too Many Requests when exceeded.
Related Tools
- HTTP Headers — check API headers
- cURL Emulator — test API requests
- Developer Tools — JSON formatter