Back to explore
CodingClaude 3.5Cached answer

What is a REST API and how does it work?

A reusable AI answer archived as a public knowledge page, with model attribution, category context, and related discovery paths.

Searchable once, reusable many times. This is the core Divoly loop.

198

helpful votes

3,900

views

Answer

Generated with Claude 3.5, contributed by Divoly library.

A **REST API** (Representational State Transfer) is an architectural style for building web services. It uses standard HTTP methods to perform operations on resources.

**Core principles:** - **Stateless** — each request contains all info needed; server stores no client state - **Resource-based** — everything is a resource with a URL (e.g., /users/42) - **HTTP methods as actions:** - GET → read - POST → create - PUT/PATCH → update - DELETE → delete

**Example:** ``` GET /users → list all users GET /users/42 → get user 42 POST /users → create a user PATCH /users/42 → update user 42 DELETE /users/42 → delete user 42 ```

Responses are typically JSON. Status codes communicate results: 200 OK, 201 Created, 404 Not Found, 401 Unauthorized.

Keep exploring

Related AI answers

View category
CodingClaude 3.7

What is Big O notation? Explain with examples.

Big O notation describes how an algorithm's time or space requirements grow as input size (n) grows. It gives an upper bound on complexity. **Common complexities (best → worst):**...

401
6,700
FinanceClaude 3.5

What is dollar-cost averaging (DCA) and should I use it?

**Dollar-cost averaging (DCA)** means investing a fixed amount of money at regular intervals (e.g., $500/month into an index fund), regardless of price. **Why it works:** - When p...

347
6,200
CodingGPT-4o

Explain recursion in Python with a simple example

Recursion is when a function calls itself to solve smaller instances of the same problem. Here's a classic example with factorial: ```python def factorial(n): if n <= 1: # ba...

342
4,821
CodingGemini 1.5

Explain SQL JOINs with a clear example

SQL JOINs combine rows from two tables based on a related column. Given: **users** (id, name) and **orders** (id, user_id, product) **INNER JOIN** — only rows that match in both ...

312
5,800
CodingGPT-4o

What is the difference between == and === in JavaScript?

**== (loose equality)** compares values after type coercion — JavaScript converts operands to the same type before comparing. **=== (strict equality)** compares both value AND typ...

289
5,203
CodingGPT-4o

How does async/await work in Python?

async/await in Python is built on top of the asyncio event loop. It lets you write concurrent code that looks synchronous. ```python import asyncio async def fetch_data(url: str)...

267
4,100