Book a demo
Is your documentation AI-agent ready? - Get your free Agent Score in 30 seconds!
rest api vs soap
API Documentation

How Does a REST API Work with Examples and Challenges

• Published: •

Updated on Dec 3, 2026

Create Free Documentation
View all

A REST API lets one piece of software ask another for data or an action over the web. This guide is for developers, technical writers and product teams at software companies. Inside, you get the meaning, one real request and response taken apart, the methods and status codes behind them, and a short guide to documenting your own REST API.

A REST call in one line: Client > Request (method + URL) > Server > Response (status code + data).

What Is a REST API?

A REST API is how one program asks another for data or for an action over the web. The asking program, the client, sends an HTTP request to a URL. The server that owns the data replies with a status code and, in most cases, a JSON body. REST is the set of design rules behind this exchange.

A REST API that follows every rule is also called a RESTful API, and people use the two names for the same thing. The client can be a mobile app, a website or another server. The server holds the data and the rules for changing it.

Think of a weather app. It does not store the forecast. It asks a weather service for it through an API, and the service replies with the data the app shows on screen.

What Does REST Stand For?

REST stands for Representational State Transfer. It is an architectural style that computer scientist Roy Fielding defined in his doctoral dissertation in 2000. API stands for Application Programming Interface. A REST API is therefore an interface that follows the REST style, so programs can talk to each other over HTTP.

The word “representational” is the part people trip over. The server never sends you the thing itself, such as a customer record in its database. It sends a representation of it, most often a JSON document that describes the customer.

How Does a REST API Work?

A REST API works in three steps. The client sends a request to an endpoint, which is a URL for a resource, with an HTTP method that says what to do. The server processes the request. It then sends back a status code and, in most cases, data.

I ran a real request against GitHub’s public REST API on 30 November 2026, so you can see each part. This is a trimmed copy, and the real response has many more fields.

REQUEST
GET https://api.github.com/repos/octocat/Hello-World
Accept: application/vnd.github+json

RESPONSE
200 OK
Content-Type: application/json; charset=utf-8

{
  "id": 1296269,
  "name": "Hello-World",
  "full_name": "octocat/Hello-World",
  "private": false,
  "description": "My first repository on GitHub!",
  "html_url": "https://github.com/octocat/Hello-World",
  "default_branch": "master"
}

Here is what each part does:

  • Method: GET tells the server to read data, not change it.
  • URL: the path /repos/octocat/Hello-World names one resource, the repository called Hello-World owned by octocat.
  • Header: Accept says which format the client wants back.
  • Status code: 200 OK tells the client the request worked.
  • Body: the JSON holds the data the client asked for.

You can read the full reference for this endpoint in GitHub’s documentation.

Which HTTP Methods and Status Codes Do REST APIs Use?

REST APIs use the standard HTTP methods GET, POST, PUT, PATCH and DELETE to read, create, replace, update and remove resources. The server answers with a status code. Codes starting with 2 mean success, 3 mean redirection, 4 mean the client made a mistake, and 5 mean the server failed.

Method

What it does

Example

Common success code

GET

Reads a resource

View a list of products

200 OK

POST

Creates a resource

Submit a new order

201 Created

PUT

Replaces a resource

Replace a customer profile

200 OK, 201 Created or 204 No Content

PATCH

Changes part of a resource

Update only the phone number

200 OK or 204 No Content

DELETE

Removes a resource

Delete a saved address

200 OK or 204 No Content

 

The difference between PUT and PATCH matters. PUT replaces the whole resource with what you send, while PATCH applies a partial change.

Errors come back with their own codes. If a client asks for a resource that does not exist, the server returns 404 Not Found. I asked GitHub for a repository that is not there and got this:

REQUEST
GET https://api.github.com/repos/octocat/no-such-repo-xyz

RESPONSE
404 Not Found

{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest/repos/repos#get-a-repository",
  "status": "404"
}

Two more codes are worth knowing. 400 Bad Request means the server could not understand the request. 401 Unauthorized means the client has not proved who it is, so it must authenticate first.

What Are the Core Principles of a REST API?

A REST API follows six design principles, also called constraints. They are client-server separation, statelessness, cacheability, a uniform interface, a layered system, and optional code on demand. Together they keep an API simple to use, easy to scale and independent of how the client is built.

  • Client-server separation: the user interface and the data storage evolve independently, so one team can change one side without breaking the other.
  • Statelessness: every request carries all the information the server needs, and the server keeps no session state between them.
  • Cacheability: responses say whether the client may store them for a while, which saves time and server load.
  • Uniform interface: each resource has its own URL, and you work on it with the same standard HTTP methods as every other resource.
  • Layered system: other servers, such as a load balancer or a security proxy, can sit between the client and the server, and the client never needs to know.
  • Code on demand (optional): a server can send code that the client runs.

Statelessness is the one that shapes daily work. Because the server keeps no session state between calls, each request must include its own credentials and context.

Schedule a demo with one of our experts to take a deeper dive into Document360

Book A Demo
Document360

What Are Examples of a REST API?

A REST API is any web API built on these rules. GitHub’s public REST API is a clear example: a request to a repository URL returns a JSON description of that repository. Everyday apps use the same pattern, such as a weather app fetching a forecast or a shop loading its products.

The two GitHub calls above are real. The next ones are illustrations, not real services, so you can see how the pattern repeats:

  • Weather app: GET /forecast?city=Chicago returns the forecast as JSON.
  • Online store: GET /products lists products, and POST /orders creates an order.
  • Support portal: GET /tickets/482 returns one ticket, and PATCH /tickets/482 changes its status.

Notice that the nouns in the URLs (forecast, products, orders, tickets) are resources, and the HTTP method is the verb.

What Is the Difference Between an API and a REST API?

An API is any interface that lets one program use another. REST is one style for building web APIs. A REST API is an API built in that style, and a RESTful API is a REST API that follows all the REST principles. So every REST API is an API, but not every API is REST.

  • API: the general term. It covers web APIs, library APIs and operating system APIs.
  • REST: the set of design rules, not a product or a protocol.
  • REST API or RESTful API: a web API that follows those rules.

What Is the Difference Between REST, SOAP, and GraphQL?

REST uses resources, URLs and HTTP methods. SOAP sends highly structured XML messages and is linked to enterprise and older systems. GraphQL gives the client one endpoint where it asks for exactly the fields it wants. REST is the most common of the three for sending data over the internet.

 

REST

SOAP

GraphQL

How you ask

Call a URL for a resource with an HTTP method

Send a structured XML message

Send one query to a single endpoint

Message format

JSON is common

XML

You choose the fields, and the server returns that shape

Strength

Simple to read and use

Strict structure and advanced security features

Fewer round trips, because you ask for exactly what you need

Often found in

Public and internal web APIs

Enterprise and legacy systems

Apps where the client needs flexible data

 

💡 Tip

Pick the style that fits the team and the data. The table describes how each one works, not which one wins.

How Do You Document a REST API?

To document a REST API, describe every endpoint in the same layout: the method and path, its parameters, a request example, a response example, the status codes and errors it can return, and how to authenticate. Then ask someone outside the team to follow the page and note where they get stuck.

Good REST API documentation answers one question for each endpoint: what do I send, and what do I get back? The GitHub example in this guide is that pattern in small form.

A machine-readable OpenAPI file can hold the endpoint facts, so the reference matches the API. Written guides on top of it show a new developer how to make a first call. For the full method, templates and a filled-in sample endpoint, read our guide to API documentation.

How Can Document360 Help You Document Your REST API?

Document360 can publish your REST API reference next to your guides, so developers stay in one site. It imports an OpenAPI or Postman file, keeps the reference in sync with your spec, and lets readers test endpoints from the page. It does this in a dedicated API documentation workspace.

These are the parts of the API documentation solution that matter for a REST API:

  • Import and sync: add an OpenAPI/Swagger or Postman link, or upload JSON. The Document360 CLI can resync the reference whenever a merge changes the spec. It works with OpenAPI 2.0, 3.0, 3.1 and 3.2, and Postman.
  • Try It! console: readers make live requests from the docs, with schema validation, session variables and in-console authorization.
  • Versions: separate reference sets for each supported API version, so readers do not mix them up.
  • One site: references and guides share navigation, styling and search.
  • AI answers: Eddy AI sits inside the reference to answer with endpoint context, and the MCP server serves your docs to MCP-aware AI agents.

💡 Takeaway

If your API reference lives in one tool, your guides in another and your examples in a third, developers lose time and trust. The fix is one home for the reference, a spec that stays in sync and an owner for each API. Document360’s API documentation solution is one place to see how a team can set that up.

Help every developer find answers fast with structured, searchable API docs.

cta

❓Frequently Asked Questions

What is the difference between an API and a REST API?

An API is any interface that lets programs talk to each other. A REST API is a web API built on REST rules: resources at URLs, standard HTTP methods and stateless requests. Every REST API is an API, but many APIs, such as SOAP ones, are not REST.

What is an example of a REST API?

GitHub's public REST API is one. Sending GET to api.github.com/repos/octocat/Hello-World returns a JSON description of that repository with a 200 OK status. A request for a repository that does not exist returns 404 Not Found.

What are the 7 main types of APIs?

There is no official list of seven. Postman's guide to APIs groups APIs by who can use them (private, partner and public) and by style (REST, SOAP, GraphQL, webhooks and gRPC). REST is the most common style for sending data over the internet.

Is Postman a REST API?

No. Postman is a tool for working with APIs, including sending requests, testing and documenting them. You can use it to call a REST API, but Postman itself is not an API style or a REST API.

What does REST stand for?

REST stands for Representational State Transfer. It is an architectural style for web APIs that Roy Fielding described in his 2000 doctoral dissertation. A REST API is an API that follows that style.

Shakeer Hussain

I'm Shakeer Hussain S, Senior Manager of Solutions Engineering at Kovai.co, the company behind Document360. I work directly with customers to understand their requirements, design solutions around Document360 and bring what I learn back into the product roadmap. My core areas are API documentation, developer experience, product strategy and knowledge management. I have 19+ years of experience in technology. Before moving into solutions engineering, I led product management for Document360 for nearly four years, heading a team of product managers and owning the platform's strategy and roadmap. Before that, I was a Senior Product Manager at Sitel Group. I also spent more than a decade at Sutherland, starting in technical support and going on to lead product management for an in-house knowledge management solution. On the Document360 blog, I write about API documentation, OpenAPI, developer documentation practices and software requirements. I've also written Document360's own feature announcements, including Postman Collection support for its API documentation. My Customer Connect webinar walks through the redesigned Document360 API v3 reference. I hold the API Product Manager certification from API Academy and Product School micro-certifications in product strategy, product-led growth and product analytics. I also hold a BBA from the National Institute of Management Studies.

Read more
Request Documentation Preview