beginnerBuilding REST APIs

What's the difference between `@RequestBody` and `@RequestParam`?

`@RequestBody` deserializes the entire HTTP request body (typically JSON) into a Java object via Jackson, used for POST/PUT payloads. `@RequestParam` reads a single named value from the URL query string or form data, used for simple scalar inputs like `?page=2`. Mixing them up — expecting a `@RequestParam` when the client actually sent a JSON body — is a common source of 400 errors.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Spring Ecosystem Mastery library.

What's the difference between `@RequestBody` and `@RequestParam`?

Next Step

Continue to Why should a REST controller return `ResponseEntity<T>` instead of just `T`?← Back to all Spring Boot questions