Home Knowledge Base REST API (Representational State Transfer)

REST API (Representational State Transfer) is the architectural style for distributed hypermedia systems that uses HTTP methods (GET, POST, PUT, DELETE) and resource URLs to define a uniform interface for client-server communication — the dominant API design pattern for public-facing web services, LLM APIs, and cloud services where human readability, broad client compatibility, and ecosystem tooling matter more than raw performance.

What Is REST?

Why REST Matters for AI/ML

Core REST Concepts

Resource Operations: GET /v1/models → List available models GET /v1/models/{id} → Get specific model metadata POST /v1/chat/completions → Create a chat completion POST /v1/fine-tuning/jobs → Create a fine-tuning job GET /v1/fine-tuning/jobs/{id} → Check fine-tuning job status DELETE /v1/fine-tuning/jobs/{id} → Cancel a job

HTTP Status Code Semantics: 200 OK — Request succeeded, response body contains result 201 Created — POST succeeded, new resource created 400 Bad Request — Client error: invalid parameters or malformed JSON 401 Unauthorized — Missing or invalid API key 403 Forbidden — Valid key but insufficient permissions 404 Not Found — Resource doesn't exist at this URL 422 Unprocessable — Request syntax valid but semantically incorrect 429 Too Many Requests — Rate limit exceeded, check Retry-After header 500 Internal Error — Server-side failure, not the client's fault

Python REST Client (requests): import requests

response = requests.post( "https://api.openai.com/v1/chat/completions", headers={"Authorization": f"Bearer {api_key}"}, json={ "model": "gpt-4o", "messages": [{"role": "user", "content": "Explain REST APIs"}], "temperature": 0.7 } ) response.raise_for_status() result = response.json()

REST vs Alternatives

AspectRESTgRPCGraphQL
ProtocolHTTP/1.1+HTTP/2HTTP/1.1+
FormatJSONProtobuf (binary)JSON
SchemaOptional (OpenAPI)Required (.proto)Required (SDL)
StreamingSSE/WebSocketNativeSubscriptions
Browser supportUniversalLimitedUniversal
Learning curveLowMediumMedium
Best forPublic APIs, LLM APIsInternal servicesComplex data graphs

REST API is the universal interface pattern that makes distributed systems interoperable — by building on ubiquitous HTTP, human-readable JSON, and resource-oriented URLs with well-understood semantics, REST APIs achieve the broadest client compatibility and lowest integration barrier of any API style, which is why every LLM provider, cloud service, and ML platform exposes REST as its primary interface.

rest apihttpjson

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.