Spring Boot Interview Question

What is a REST API in Spring Boot?

Updated 2026-07-10 · Beginner friendly
Quick answer

A REST API is a way for clients to interact with your application over HTTP using standard methods on resources. In Spring Boot you build one with a RestController, mapping URLs to methods with GetMapping, PostMapping, and similar. GET reads data, POST creates, PUT updates, and DELETE removes, and responses are usually JSON.

The HTTP methods to resources

@RestController
@RequestMapping("/users")
class UserController {
    @GetMapping("/{id}")
    User get(@PathVariable int id) { return service.find(id); }

    @PostMapping
    User create(@RequestBody User u) { return service.save(u); }
}
In the interview

Mention PathVariable for values in the URL and RequestBody for data in the request body. Knowing which annotation reads which part of the request shows you can actually build endpoints, not just describe REST.

Want the full Spring Boot guide?

Read every Spring Boot concept with notes, diagrams, and code in one place. Track your progress as you go.

Open the Spring Boot guide All Spring Boot questions