# REST API interview questions and answers

Aced (formerly Exponent) publishes a public search API over its indexed pages; the guide is at https://www.aced.io/agents/agent-access.

Source: https://www.aced.io/blog/top-rest-api-interview-questions
Source observed: 2026-11-05T00:52:47.599Z
Last checked: 2026-11-05T00:52:47.599+00:00
Indexed: 2026-11-07T03:03:16.615+00:00

---

# REST API interview questions and answers

We published this Software Engineering article to help candidates prepare for backend, full-stack, and other software developer interviews. It explains REST API concepts, common interview questions, implementation practices, and related Aced preparation resources.

## Aced interview-preparation resources

We provide preparation for software engineering and system design interviews, including courses, interview questions, company guides, practice tools, and coaching.

- [System design interview prep course](https://www.aced.io/courses/system-design-interviews?ref=exponent-blog.ghost.io), including mock interviews, company guides, and private coaching.
- [System design interview guide](https://www.aced.io/blog/system-design-interview-guide?ref=exponent-blog.ghost.io)
- [Software developer career information](https://www.aced.io/blog/software-engineer-career-path/?ref=exponent-blog.ghost.io)
- [API questions in system design interviews](https://www.aced.io/courses/system-design-interviews/system-design-apis?ref=exponent-blog.ghost.io)

Our linked sample and practice topics include [Design Instagram](https://www.aced.io/questions?src=blog&ref=exponent-blog.ghost.io), [TinyURL](https://www.aced.io/courses/system-design-interviews/url-shortener?src=blog&ref=exponent-blog.ghost.io), and [YouTube](https://www.aced.io/courses/system-design-interviews/design-youtube?src=blog&ref=exponent-blog.ghost.io).

## What is REST?

REST means **Representational State Transfer**. It is an architecture based on communication between a client and server through requests and responses without storing the client's state on the server. A web service or API following REST is RESTful.

REST transfers resources from a server to a client through an HTTP method and a URI. Before REST, SOAP commonly implemented APIs with XML documents and Remote Procedure Calls. Roy Fielding established REST's universal rules in 2000. Amazon and eBay adopted REST APIs in 2002, and large-scale adoption had occurred by 2006.

## How REST APIs are stateless

A stateful application, API, or web service stores client data on its servers. For example, if a server stores a username and password sent for authentication, that server is stateful.

REST requires that the client's state not be stored on the server. Every request must instead contain all information necessary for that HTTP operation.

## HTTP methods

RESTful web services use HTTP methods in client requests:

- **GET:** Fetches a resource. A URI with an ID may fetch one resource; a URI without an ID may fetch many.
- **POST:** Requests creation of a resource. The client sends the required information, and the server should return the created resource.
- **PUT:** Requests an update by providing a new version of a resource. If the resource does not exist, it will be created.
- **PATCH:** Updates only specified parts of a resource rather than replacing the whole resource. If the resource does not exist, an error occurs rather than creating it.
- **DELETE:** Requests deletion of one or many resources.
- **OPTIONS:** Returns the HTTP operations supported at a URI.
- **HEAD:** Returns URI metadata.

GET, POST, PUT, and DELETE are the most common methods because they correspond to CRUD: Create, Read, Update, and Delete.

## HTTP status codes

HTTP status codes in server responses have five categories:

- **1xx:** Informational response.
- **2xx:** Successful request and response.
  - **200:** Request succeeded; a generic, common success code.
  - **201:** Resource creation succeeded, typically after POST.
- **3xx:** Redirect; the client needs further action.
- **4xx:** Client-side error.
  - **400:** Bad client request; the client's request has an issue and the server was not at fault.
  - **401:** The user lacks the necessary authorization.
  - **404:** Resource not found or method unavailable. Common when a URI lacks a resource required for GET, DELETE, or PUT.
- **5xx:** Server-side error.
  - **500:** Generic server error while processing the client's request.
  - **502:** The server did not receive a response from another server it contacted.

The most common categories are 2xx, 4xx, and 5xx.

For related interview practice, see [HTTP versus HTTPS](https://www.aced.io/courses/fundamentals-system-design/http-vs-https?ref=exponent-blog.ghost.io) and [how an HTTP request works](https://www.aced.io/questions/1206/how-http-request-works?ref=exponent-blog.ghost.io).

## What is a URI?

A **URI**, or Uniform Resource Identifier, identifies a resource in REST. A URI can be:

- **URN:** Identifies a resource with a unique, persistent name, such as an ISBN or ISSN.
- **URL:** A web address that identifies a resource and indicates where it can be found.

Example:

```text
https://www.aced.io/courses/software-engineering/
```

This URL contains the `https://` protocol, the `aced.io` domain, the `/courses/software-engineering` path, and potentially an ID identifying a specific resource. Locating a resource through a URI or URL is called **addressing**. On the web, URL and URI are commonly used interchangeably.

### URI design best practices

- **Use forward slashes to show hierarchy.** For example, `aced.io/users/{id}` identifies a user, `aced.io/courses/software-engineering` identifies a course collection in a category, and `aced.io/users/{id}/accounts` identifies a collection belonging to a user.
- **Use plural nouns for collection branches.** Prefer `aced.io/users/{id}` over `aced.io/user/{id}` because `users` represents a collection and the ID identifies one member.
- **Use hyphens for multiple words.** Spaces can cause errors, while underscores may appear as spaces.
- **Use lowercase letters.** Although URIs are not case sensitive, lowercase is recommended.
- **Maintain backward compatibility.** When deprecating a URI, use a 300-level redirect to the updated URI as needed.
- **Do not put HTTP methods in URIs.** Use nouns rather than verbs; prefer `aced.io/users` over `aced.io/getUser`.
- **Avoid file extensions.** Prefer `aced.io/example` over `aced.io/example.json` because extensions add complexity without value.

## REST versus SOAP

REST is an architecture for developing web services. SOAP, or Simple Object Access Protocol, is a protocol for exchanging structured information through APIs.

REST uses flexible standards, while SOAP has stricter implementation standards and is often more stateful, creating a closer client-server relationship. REST supports JSON, XML, and other formats; SOAP supports XML only. SOAP is a stricter, more specialized alternative for regulated or stateful data transfer.

## REST versus AJAX

AJAX means Asynchronous JavaScript and XML. It is a collection of web technologies for asynchronous applications using the XMLHttpRequest object.

A REST API is an architecture for handling HTTP requests; AJAX is a collection of technologies for making asynchronous web requests. A REST API can handle AJAX clients, and AJAX can send RESTful requests, but AJAX cannot implement or replace a REST API.

## Tools for developing and testing REST APIs

The appropriate development tools depend on the programming language:

- **Node.js:** Express, Nest, and Fastify
- **Java:** Spring and Jersey API
- **Python:** FastAPI, Django REST Framework, and Flask

For testing, **Postman** is widely used to test REST APIs in professional software development and check that resources are delivered and API behavior works as designed. Alternatives include **Insomnia**, which some developers find easier to use, and **SOAP UI**, which tests both REST and SOAP APIs.

## Real-world REST API examples

Entering a website can trigger a GET request to a server for the HTML needed by the client. Developers commonly use REST APIs to manipulate database data through HTTP methods mapped to CRUD operations. Retrieving file data, accessing images, and hosting a website can also commonly involve REST APIs.

## Advantages and disadvantages of RESTful web services

### Advantages

- HTTP and its methods make REST easy to learn.
- REST supports data formats such as JSON, XML, and MIME.
- Statelessness can simplify the client experience.
- Cacheable responses can reduce client bandwidth usage.
- A broad testing and development ecosystem exists, including Postman.
- Independent clients and servers make REST APIs scalable.
- Web applications, iOS applications, and most other client technology stacks can use REST because requests use a simple HTTP format and are not tied to a particular client technology.

The article does not provide a separate list of disadvantages.

## PUT, POST, and PATCH

- **POST** creates a new resource.
- **PUT** updates a specified resource by replacing it with a new version; it can create the resource if it does not exist.
- **PATCH** updates only the fields specified in the request body and does not create a missing resource.

## Payloads

A **payload** is data transferred through a REST request or response. A GET response carries the requested resource as its payload. In a POST request, the client sends the payload needed to create a resource, and the server returns the created resource as a response payload.

## REST messages

Messaging is the back-and-forth exchange of requests and responses between client and server. Responses typically include a message associated with the status code. Messages help with debugging and testing and may confirm that a resource was created or describe an exception.

## Components of an HTTP request

An HTTP request has five components:

1. **Method:** The operation or verb, such as GET, POST, PUT, or DELETE.
2. **URI:** Identifies the resource, usually through a URL. An ID can distinguish one resource from a collection.
3. **HTTP version:** Typically HTTP 1.1 or HTTP 2.0.
4. **Request header:** Contains metadata such as message format, cache settings, and content format.
5. **Request body:** Contains the data being sent. For POST and PUT, the body requires the data for the new resource; the article describes this as the entire data for the new resource.

## Components of an HTTP response

An HTTP response has four components:

1. **Status code:** Indicates success or failure. 2xx indicates success, 4xx a client error, and 5xx a server error.
2. **HTTP version:** Typically HTTP 1.1 or HTTP 2.0.
3. **Response header:** Contains metadata such as content length, content type, and date.
4. **Response body:** Contains returned data. Unlike a request body, which is not always required, a response should always contain a response body.

| Request method | Response body contents |
|---|---|
| GET | Data reflecting the fetched resource |
| POST | Data reflecting the newly created resource |
| PUT | Data reflecting the new version of the specified resource |
| DELETE | Data reflecting the deleted resource |

## Idempotent methods

An idempotent method produces the same response regardless of how many times the same request is sent. For example, repeatedly pressing a button that sends a GET request for `resource1` should return the same response after the first press.

Because REST is stateless and clients should not depend on previous calls, methods should be idempotent whenever possible. Among the basic methods discussed, POST may not be idempotent: each POST can create another resource.

## Idempotent versus safe methods

An idempotent method can be called repeatedly without changing the response. A **safe** method does not change a resource; it may read but not write. GET is safe.

| HTTP method | Idempotent | Safe |
|---|---:|---:|
| OPTIONS | Yes | Yes |
| GET | Yes | Yes |
| HEAD | Yes | Yes |
| PUT | Yes | No |
| POST | No | No |
| DELETE | Yes | No |

## Caching in REST

When a client requests the same data repeatedly, caching can reduce bandwidth and speed retrieval. The `Cache-Control` and `Expires` headers specify what responses may be cached, by whom, and for how long. Caching can lower latency and reduce server load.

## RESTful web-service best practices

### Support JSON

JSON is a common web data-transfer format. Support it by setting `Content-Type` to `application/json` so the API responds in JSON.

### Use appropriate status codes

Handle every request outcome and always return a status code; a 500 response is preferable to a timeout. Use specific codes where possible—for example, return 201 when a resource is successfully created instead of the generic 200.

### Represent resource relationships with URI hierarchy

Design URI hierarchy to accurately represent relationships between resources, while avoiding excessive nesting that makes an API harder to use.

### Use idempotent methods

For reliability, handle requests without depending on prior requests.

### Implement caching

Use caching to reduce server load and bandwidth, while updating data regularly to prevent staleness.

### Add security measures

REST does not inherently provide security. Implement **Transport Layer Security (TLS)**, a cryptographic protocol that encrypts data between client and server and helps create a secure transfer channel. Also use role-based access so users cannot access resources reserved for senior developers or administrators.

## More Aced resources

- [Software engineering interview preparation](https://www.aced.io/courses/software-engineering?ref=exponent-blog.ghost.io)
- [Solutions Architect interview questions and answers](https://www.aced.io/blog/how-to-prepare-for-a-solutions-architect/?ref=exponent-blog.ghost.io)
- [Example interview questions](https://www.aced.io/questions?src=blog&ref=exponent-blog.ghost.io)
- [Company-specific interview guides](https://www.aced.io/guides?src=blog&ref=exponent-blog.ghost.io)
- [Interview practice tool](https://www.aced.io/practice?src=blog&ref=exponent-blog.ghost.io)
- [Browse software engineer interview questions](https://www.aced.io/questions?role=swe&src=blog)
- [Book time with a Software Engineer coach](https://www.aced.io/coaching?role=swe), including mock interviews, career coaching, and resume review: [browse coaches](https://www.aced.io/coaching?role=swe&src=blog)

We advertise a **96% rating from 5,400 reviews** and invite readers to [create a free account](https://www.aced.io/signup?src=blog). We describe Aced as a tech interview preparation platform offering free interview guides, insider tips, and courses.

### Related courses

- [Software Engineering Interview Prep Course](https://www.aced.io/courses/software-engineering) — **5 courses**, **41,700 students**. Covers data structures, algorithms, system design, people management, behavioral interviews, mock interviews, frameworks, and advice from senior candidates, with preparation for Google, Amazon, Microsoft, Meta, Apple, and other companies.
- [Amazon Software Development Engineer (SDE) Interview Course](https://www.aced.io/courses/amazon-sde-interview) — **5 courses**, **4,600 students**. Covers data structures, algorithms, system design, detailed questions, mock interviews, and Amazon leadership principles.

### Related blog posts

- [Most Asked Swift Interview Questions And Answers](https://www.aced.io/blog/top-swift-interview-questions-and-answers) — A month ago; 13 min read.
- [Junior Software Developer Interview Tips](https://www.aced.io/blog/junior-software-developer-interview-tips) — A month ago; 8 min read.
- [How to Prepare for a Security Engineer Interview](https://www.aced.io/blog/how-to-prepare-for-a-security-engineer-interview) — A month ago; 7 min read.
- [How to Find a Great Software Engineer Recruiter](https://www.aced.io/blog/how-to-find-a-great-software-engineering-recruiter) — A month ago; 12 min read.

## Page details

- **Category:** [Software Engineering](https://www.aced.io/blog/tag/swe)
- **Author:** Tatsat Jha
- **Last updated:** A month ago

## Source image

![Article illustration](https://storage.ghost.io/c/a5/f5/a5f5c2f0-4c62-43c7-891b-662a0b6d68b3/content/images/2022/07/mega-creator--2-.svg)

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fblog%2Ftop-rest-api-interview-questions&trace=t_679ff9ab98f3)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Aced (formerly Exponent)’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.aced.io/agents/agent/faq?q={question}&trace=t_679ff9ab98f3`

[Tool guide and examples](https://www.aced.io/agents/agent-access) · [OpenAPI](https://www.aced.io/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.aced.io/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fblog%2Ftop-rest-api-interview-questions). Opening a form does not execute a tool.