Skip to content
Reviewed by Bipeen Sinha Oct 31, 2026

Home › Guides › What is a REST API

Tech Explained · 2026

What Is a REST API? Plain-English Definition, How It Works and a Worked Example in 2026

A REST API is a web interface that lets one program use another over HTTP: you send a request to a URL naming a resource, with a method such as GET or POST, and you get back JSON plus a numeric status code. REST sets out 6 architectural constraints, and nearly every public API follows most of them.

31 October 202611 min readBy the 360 Digital Transformation Editorial Team
Key takeaways
  • A REST API is a contract, not a technology. There is no REST library to install, only rules about how URLs, methods and status codes behave.
  • Five HTTP methods cover almost everything: GET, POST, PUT, PATCH and DELETE, mapping to read, create, replace, amend and remove.
  • Status codes are the API talking to you: 401 means your credential is wrong, 403 means it is right but unprivileged, 429 means slow down.
  • Rate limits are documented, so read them first. GitHub's docs put an authenticated token at 5,000 requests an hour; Open-Meteo's free terms allow under 10,000 calls a day.
  • Versioning is what bites you. GitHub pins versions by date in an X-GitHub-Api-Version header and returns 410 Gone for retired ones.
  • Learn REST before GraphQL. Webhooks, cloud control planes and agent tool calls are overwhelmingly REST shaped.

Your integration worked all last week. This morning a shipment lookup started returning 401, nothing in your code changed, and the vendor's status page is green. That gap, between code that looks right and an API that disagrees, is where most people meet REST properly. The fix is rarely clever: it is knowing what your request actually contained and what the response was trying to tell you.

How Does a REST API Work, Step by Step

A REST API publishes a list of URLs, where one URL identifies one kind of thing. /v1/shipments is the collection; /v1/shipments/4821 is one specific shipment. The verb you pair with that URL decides what happens to it.

Take a two person engineering team at a Pune logistics startup, wiring their ops dashboard to a courier partner's API. They have a base URL, a key and a page of docs. Here is what one lookup actually does.

One REST request, end to end

The five hops every call makes, and where each failure code is produced.

Lifecycle of a single REST API request A client sends an HTTP GET request with a bearer token to an API server, which checks authentication and rate limits, queries a datastore, serialises the rows to JSON and returns a 200 OK response that the client then reads. Your app (the client) ops dashboard, script or agent API server route: /v1/shipments/4821 1. GET + Bearer token Auth, rate limit, validation fails here as 401, 403 or 429 2. checks Datastore one row, id 4821 3. query 200 OK + JSON body {"id":4821,"status":"in_transit"} 4. serialise to JSON 5. your code parses it

Generic request lifecycle; the status codes shown are the ones named in the HTTP specification. Checked 31 October 2026.

The 5 HTTP methods you will actually use

Two columns matter more than people expect. Safe means the call changes nothing; idempotent means sending it five times leaves the server exactly as sending it once would. That second property is what makes a retry safe.

Method and example What it does Safe Idempotent Typical success code
GET /v1/shipments Read a collection, usually paginated Yes Yes 200 OK
POST /v1/shipments Create one new shipment No No 201 Created, with a Location header
PUT /v1/shipments/4821 Replace that shipment entirely No Yes 200 OK or 204 No Content
PATCH /v1/shipments/4821 Change only the fields you send No Not guaranteed 200 OK
DELETE /v1/shipments/4821 Remove that shipment No Yes 204 No Content

The Pune team's first bug is in that table. They retried failed POST calls on timeout and created duplicate shipments, because POST is not idempotent and a timeout never tells you whether the server finished. The fix is an idempotency key: a unique string per logical operation, sent as a header, so the server replays the original result instead of writing a second record. Most payment and logistics APIs document it under that exact name.

What Is a REST API? The 6 Constraints Behind the Name

REST stands for Representational State Transfer, described by Roy Fielding in his 2000 doctoral dissertation. He did not invent a product; he wrote down the properties that made the web scale, as constraints a system either satisfies or does not. Five are required and one is optional, which is why you see both "five" and "six" quoted.

  1. Client and server are separate. They share only the interface, so either side can be rewritten alone.
  2. Statelessness. Every request carries everything needed to serve it, which is exactly why you send your token on every call rather than logging in once.
  3. Cacheability. Responses declare whether they may be stored and reused, via Cache-Control and ETag.
  4. A uniform interface. Resources have identifiers, standard methods act on them, and responses name their own media type, such as application/json.
  5. A layered system. The client cannot tell an origin server from a cache, a load balancer or a gateway. Also read: what load balancing actually does.
  6. Code on demand, optional. The server may ship executable code to the client. Almost nobody does this deliberately.

Here is the honest part. Most APIs calling themselves RESTful break at least one constraint, usually the uniform interface, because they never return links telling the client what it can do next. In practice "REST API" now means "an HTTP API organised around resources that returns JSON", and that is what job ads mean too. Learn the constraints to understand why statelessness forces a token onto every call, then expect real APIs to honour only some of them.

REST, in four numbers

The figures worth memorising before your first integration.

6
Architectural constraints, one of them optional
5
HTTP methods behind nearly every endpoint
5,000/hr
GitHub's documented REST limit for a personal access token
10,000/day
Open-Meteo's free non-commercial call ceiling

Constraint count from Fielding's 2000 dissertation; limits from GitHub's REST rate limit documentation and Open-Meteo's terms page, both checked 31 October 2026.

A Worked REST API Example You Can Run in 60 Seconds

Reading about HTTP teaches you little; running two commands teaches you a lot. Open-Meteo needs no key at all, which makes it the cleanest first target available. Its terms page allows fewer than 10,000 API calls a day, 5,000 an hour and 600 a minute on the free non-commercial service, so practice will not come near the ceiling. One caveat from Open-Meteo's own blog: calls are weighted, so a request spanning over 14 days or over 10 weather variables counts as more than one.

Paste this into a terminal. The second pipes through jq so you see the JSON's shape instead of one long line.

curl -s "https://api.open-meteo.com/v1/forecast?latitude=18.52&longitude=73.86&current=temperature_2m"

curl -s "https://api.open-meteo.com/v1/forecast?latitude=18.52&longitude=73.86&daily=temperature_2m_max&timezone=Asia%2FKolkata" \
  | jq '.daily.time, .daily.temperature_2m_max'

Three things there generalise to every REST API you will call. The path /v1/forecast names a resource and carries a version. Everything after the question mark is a query parameter, shaping the response without changing which resource you asked for. The body is JSON with predictable keys, which is what makes it readable by code.

Now add -i to see headers, where the operationally useful information lives. GitHub's documentation puts unauthenticated requests at 60 an hour, a budget you can exhaust by accident.

curl -i -s -H "Accept: application/vnd.github+json" \
     -H "X-GitHub-Api-Version: 2026-03-10" \
     https://api.github.com/repos/python/cpython | head -20

# look for these in the output:
#   HTTP/2 200
#   x-ratelimit-limit: 60
#   x-ratelimit-remaining: 57
#   x-ratelimit-reset: 1762000000

If you do nothing else from this article, run those commands. Watching x-ratelimit-remaining fall by one per call is the moment the abstraction turns concrete.

Writing the other side: a REST API in 20 lines

Consuming an API is half the skill. Here is the smallest useful server, using FastAPI, whose release notes list 0.140.1 of 27 July 2026 as the latest published version at the time of checking. Prefer it over bare Flask for one reason: it builds an interactive OpenAPI page at /docs from your type hints, so the API documents itself.

from fastapi import FastAPI, HTTPException
from pydantic import BaseModel

app = FastAPI()
SHIPMENTS = {4821: {"id": 4821, "status": "in_transit", "city": "Pune"}}

class ShipmentIn(BaseModel):
    status: str
    city: str

@app.get("/v1/shipments/{shipment_id}")
def get_shipment(shipment_id: int):
    if shipment_id not in SHIPMENTS:
        raise HTTPException(status_code=404, detail="shipment not found")
    return SHIPMENTS[shipment_id]

@app.post("/v1/shipments", status_code=201)
def create_shipment(payload: ShipmentIn):
    new_id = max(SHIPMENTS) + 1
    SHIPMENTS[new_id] = {"id": new_id, **payload.model_dump()}
    return SHIPMENTS[new_id]

Run it with uvicorn main:app --reload and open http://127.0.0.1:8000/docs. Notice what declaring shipment_id: int bought you: send /v1/shipments/abc and the framework returns 422 naming the bad field, before your function ever runs. Validation at the edge is the highest value habit in API work. Endpoints like this are the plumbing under every deployed model, which is why they sit early in 360DT's AI Engineer course instead of being assumed knowledge.

REST API vs GraphQL: Which One Should You Learn First

GraphQL is the neighbour people confuse REST with, and the comparison teaches more than the definition does. GraphQL exposes one endpoint, usually POST /graphql, and the client's query names precisely which fields come back. REST exposes many endpoints, and the server decides what each returns.

The difference shows up most clearly in how GitHub, which runs both, has to meter them. For REST its docs set an authenticated personal access token at 5,000 requests an hour, where most GET, HEAD and OPTIONS calls cost 1 point and most POST, PATCH, PUT and DELETE calls cost 5. For GraphQL the same docs set 5,000 points an hour, then state plainly that 5,000 points is not 5,000 calls, because a query's cost comes from the first and last arguments on its connections. One GraphQL call can cost what dozens of REST calls would.

Criterion REST GraphQL
Endpoints One URL per resource One URL for everything
Response shape Fixed by the server Chosen by the client query
Over-fetching Common: you receive the whole object Avoided: you name the fields
Under-fetching Deep reads need several round trips One query can walk the graph
HTTP caching Works out of the box with GET, ETag and CDNs Needs a client cache or persisted queries
Error signalling A status code per request Often 200 with an errors array in the body
Metering, per GitHub's docs 5,000 requests an hour on a token; GET costs 1 point, POST costs 5 5,000 points an hour, cost derived from connection arguments
Time to first useful call An afternoon with curl A weekend, plus a schema to hold in your head
Where it wins Public APIs, webhooks, CRUD, anything cacheable Mobile and front end screens with deep nested reads

Learn REST first, and it is not close. Cloud control planes, webhooks, Indian payment gateways and nearly every tool an AI agent calls are REST shaped. GraphQL earns its weekend once you have a real over-fetching problem, and the trade-off you accept is giving up free HTTP caching and one-status-code-per-request error handling in exchange for precise reads. Good deal for a mobile screen, bad deal for a server to server integration a CDN could have cached. Choices of this shape are what AZ-305 objectives test, which is why a live Azure architect and DevOps program teaches them as trade-offs rather than syntax.

How GitHub Versions Its REST API, and Why Integrations Break

No tutorial covers this and every working engineer has been burned by it. An API is a promise, and the provider needs a way to change the promise without breaking you. GitHub's answer is the clearest published example.

GitHub names each version after its release date and asks you to send it in a header, for example X-GitHub-Api-Version: 2026-03-10. Its docs list two supported versions: 2026-03-10, with no end of support date scheduled, and 2022-11-28, whose support ends on 10 March 2028. Omit the header and your request silently defaults to the older 2022-11-28 behaviour. Send a retired version and you get 410 Gone. Each version is supported for 24 months after a newer one ships.

That default is the lesson. A client written three years ago that never set the header is still served 2022-11-28 today, and will keep working right until March 2028, then stop. So pin the version in your HTTP client, put the end of support date in a comment beside it, and set a reminder six months out. Twenty seconds of work separates a planned migration from a Monday morning outage.

What usually goes wrong here
  • You read the body and ignore the headers. The answer to "why did this start failing" usually sits in x-ratelimit-remaining, retry-after or a deprecation header. Log headers on failure, not just the body.
  • You retry on timeout with no idempotency key. That is how one order becomes three.
  • You retry immediately, in a loop. GitHub's docs say explicitly that on a 403 or 429 you should wait for x-ratelimit-reset. Exponential backoff with jitter, every time.
  • You put the token in the URL. Query strings land in server logs, proxy logs and browser history. Credentials belong in headers.

Reading codes correctly is most of debugging, so keep this where you can find it at 2am.

Status What the server means Usual cause What to change
400 Bad Request I cannot parse what you sent Malformed JSON, wrong type, missing field Print the body you sent, then diff it against the docs
401 Unauthorized I do not know who you are Token missing, expired, or wrong header name Check the scheme word, usually Bearer
403 Forbidden I know who you are, you may not do this Token scope too narrow, or a rate limit Widen the scope, but check the rate limit headers first
404 Not Found No such resource, or none you can see Typo in the path, or wrong environment Log the full URL; sandbox ids rarely exist in production
409 Conflict That clashes with current state Duplicate create, or a stale version Send an idempotency key, or re-read before writing
422 Unprocessable Valid syntax, invalid content Failed a validation rule Read the field names in the error body, usually exact
429 Too Many Requests Slow down Burst of calls, or a shared quota Wait for x-ratelimit-reset, then throttle client side
500 or 503 My problem, not yours Upstream fault or deploy Exponential backoff with jitter; alert if it persists

Where You Will Meet REST APIs in Real Work

Giving a model tools. When an agent books a slot or checks stock, it is calling a REST endpoint: the model emits a structured call, your code turns it into an HTTP request, the JSON goes back into context. Every reliability problem in agent work is an API problem first, which means timeouts, retries, pagination and idempotency. Also read: how function calling works end to end. That is the daily substance of the AI Engineer program and of the CCDV-F developer prep course.

Moving data on a schedule. The Pune dashboard is the easy half. The hard half is a nightly job that pages through /v1/shipments?limit=100&cursor=..., takes a 429 halfway through page 40, and resumes without double counting. Orchestration against REST sources is ordinary data engineering, and a Microsoft Fabric data engineering course spends lab time on exactly it. From the reporting end, a Power BI and SQL analyst track teaches the same thing, since a web connector is a GET with a token.

Standing up and securing endpoints. Someone has to put the API behind a gateway, give it a certificate, rate limit it, log it and release it without downtime. That is cloud and DevOps ground, which a live AWS architect and DevOps course covers against the SAA-C03 and DOP-C02 objectives. If you integrate these systems inside a client's environment rather than owning them, that is closer to the Forward Deployed Engineer path. Also read: how microservices split one API into many.

What Is a REST API Bad At? Three Cases Where It Is the Wrong Tool

Knowing where REST stops is what separates someone who read a tutorial from someone who has shipped.

Streams. Live vehicle positions or a chat feed should not be a poll every two seconds. You burn quota, drain batteries and are still two seconds stale. Use WebSockets or server sent events, and keep REST for the first page load.

Deep nested reads. A screen needing a customer, their last five orders and each order's items is three or four round trips. That is the pain GraphQL was built for, and ignoring it produces sprawling one-screen endpoints that break when the screen changes.

Bulk data. Paging a hundred million rows through JSON is slow and expensive on both sides. If the provider offers a bulk export, a signed file URL or a replica, take it. Being the default does not make REST universal.

How to Learn REST APIs Properly

Six focused weekends takes you from reading docs to shipping an endpoint other people call. The sequence matters more than the hours, because each step leaves an artefact.

A six week path from first curl to a deployed endpoint

Every stage ends in an artefact you can show an interviewer.

Wk 1

Read and call

curl and jq against Open-Meteo and GitHub's public endpoints. Deliverable: a shell script printing a three day Pune forecast.

Wk 2

Codes, headers and auth

Trigger 401, 404 and 429 on purpose. Deliverable: a Python script with exponential backoff that logs every header on failure.

Wk 3

Build the server

Four FastAPI endpoints with Pydantic validation. Deliverable: a /docs OpenAPI page you can hand to someone else.

Wk 4

Persistence and pagination

Swap the dictionary for SQLite and add cursor pagination. Deliverable: a GET that answers ?limit=50&cursor= correctly.

Wk 5

Ship it

Containerise, add a health check, deploy to a free tier host. Deliverable: a public URL plus the curl command in the README.

Wk 6

Let a model call it

Describe your endpoint as a tool schema and let an LLM invoke it. Deliverable: a transcript of one successful call and one handled failure.

Indicative plan for roughly six to eight hours a week, written 31 October 2026.

Skip two things people insist on: you do not need to read the HTTP specification end to end, and you do not need a GUI client, because curl hides nothing. For the guided version of weeks 3 to 6 with live review, that is what the AI Engineer course is built around, and the full certification tracks page shows how it sits beside the cloud and data routes.

Live course

Turn REST API basics into agents that call real tools

Live online·Sat–Sun, 8–11 PM IST·100+ hrs·Rs 24,999

Most courses teach you to chat with a model; this one teaches you to build agents that plan, use tools and act. It is certified on both Microsoft Copilot Studio and Claude Code, the two stacks real job postings name.

Explore the course
AI Engineer Course: Generative AI, RAG & AI Agents (Microsoft + Claude Certified)

What I Would Do in Your Position

Spend your first evening on curl and nothing else. Not Postman, not a framework, not a video: two commands against Open-Meteo, then the same call against GitHub with -i so you see the rate limit headers move. That hour fixes the mental model everything else rests on, and most people skip it because typing a URL feels too basic to count as learning. Then build the small FastAPI service above and deploy it, keeping the scope embarrassingly small: four endpoints, one table, real validation, real pagination. An endpoint a stranger can call beats three certificates with no artefact behind them.

After that it stops being a question about REST and becomes a question about what you point it at. If the answer is agents and model APIs, the AI Engineer course is the direct route, and a free webinar costs nothing if you want to watch a live session first. Prefer to test it against your own background? Book a demo class and bring your week 3 code.

Frequently asked questions

What is a REST API in simple words?

It is a published set of web addresses that another program can call to read or change data. You pick an address such as /v1/shipments/4821, pair it with a verb such as GET or POST, send it over HTTP, and get back JSON plus a status code telling you what happened.

How does a REST API work step by step?

Your client sends an HTTP request with a method, a path, headers including credentials, and sometimes a body. The server authenticates you, checks your rate limit, validates the input, reads or writes its datastore, then returns JSON with a status code. Nothing is remembered between calls, so the next request carries the credential again.

Is a REST API the same thing as an API?

No. API is the general term for any programmatic interface, including libraries you import locally. REST is one style of web API, alongside GraphQL, gRPC and older SOAP services. Most web APIs you meet are REST style, which is why job ads use the words interchangeably.

Should I learn REST API or GraphQL first?

REST, clearly. Cloud control planes, webhooks, payment gateways and the tools AI agents call are overwhelmingly REST shaped, and the HTTP knowledge transfers to GraphQL anyway. Pick up GraphQL once you have a genuine over-fetching problem on a front end.

Which language should I use to build my first REST API?

Python with FastAPI, unless something pushes you elsewhere. Type hints alone buy you request validation and an interactive OpenAPI page, so your attention goes to API design rather than framework wiring. Node with Express and Go with net/http are equally sound.

Are REST APIs still relevant in 2026 now that MCP and AI agents exist?

More relevant, not less. Agent tool calls and protocol servers nearly always sit in front of ordinary HTTP endpoints, so an agent booking a delivery slot is still issuing a POST underneath. Weak API skills surface as agent bugs: unhandled 429s, duplicate writes, silent pagination truncation.

About this guide. 360 Digital Transformation is an Anthropic Partner and a Microsoft Authorized Training Partner. Other certification bodies, vendors and employers named here are not affiliated with us. Tools and versions change quickly; commands and figures cited were checked on 31 October 2026.

Learn it live with 360 Digital Transformation

Turn this guide into a skill employers can see

Live weekend cohortEMI available

AI Engineer Course: Generative AI, RAG & AI Agents (Microsoft + Claude Certified)

Rs. 27,999Rs. 37,239 Save 24%

Tools and platforms you work with

  • Python
  • Claude API
  • FAISS
  • ChromaDB
  • LangChain
  • LangGraph
  • CrewAI
  • AutoGen (AG2)
Add bonus modules
See the syllabus and batch dates

Other live courses on this career path