Skip to content
BENIBIX Learn

Query Parameter vs Request Body

A query parameter goes in the address, after the question mark. Anyone can see it there. A request body goes inside the request, after the headers. Short filters go in the address; passwords, forms and files go in the body.

Infrastructure🌐 Networking

Query Parameter

A name and value added after a ? in a web address, like ?page=2.

A query parameter is a name and a value added to the end of a web address. It comes after a question mark. In /search?q=shoes&page=2, q and page are query parameters. Each pair is joined with an equals sign, and pairs are split by an ampersand. They are used to search, filter, sort and pick a page. Anyone can see them, so they must never hold secrets.

Example
Jack filters a shop by colour. The address becomes /shoes?colour=red&size=9, and the server sends back only red shoes in size 9.
Why it matters
They turn a page you filtered or searched into an address. You can share it, save it and load it again.
Full entry
Infrastructure🌐 Networking

Request Body

The data sent inside a web request, after the headers. POST and PUT use one.

The request body is the data sent after the headers in a web request. It carries what you are sending, like a new user, a form or a file. POST, PUT and PATCH requests usually have one; GET and DELETE usually do not. A header called Content-Type says what format the body is in, such as JSON. A blank line separates the headers from the body.

Example
Lucy uploads a photo of 2 MB. The photo travels in the request body, and the headers say its type is image/jpeg.
Why it matters
Anything too big or too private for the address goes in the body.
Full entry

In one line

Query Parameter
A name and value added after a ? in a web address, like ?page=2.
Request Body
The data sent inside a web request, after the headers. POST and PUT use one.