REST examples are easiest to read when you focus on the resource, the method, and the data passed with the request. The path identifies the resource, such as /users or /orders/123, while the method tells you whether you are reading, creating, replacing, updating, or deleting that resource. Query parameters refine a GET request, headers describe request metadata, and JSON bodies carry fields for create and update operations. Use these conventions to interpret each example consistently.
REST API Sample Requests
Practical request formats for reading GET, POST, PUT, PATCH, and DELETE examples in a resource-oriented REST style.
Explore sample requestsRead the request patterns first
Five common request examples
GET
Use GET to read a resource or list resources. It often includes query parameters for filtering, sorting, or pagination, and usually does not include a JSON body.
POST
Use POST to create a new resource. The request commonly includes a JSON body with the fields required to create the record, plus headers that describe the content type.
PUT
Use PUT to replace a resource at a known endpoint. The request typically sends the full JSON representation of the resource, not just changed fields.
PATCH
Use PATCH to apply a partial update. The JSON body contains only the fields that need to change, making it useful for smaller edits to an existing resource.
DELETE
Use DELETE to remove a resource. The path usually identifies the item to delete, and the request body is typically omitted in a simple REST pattern.
How request parts work together
A complete REST request combines the endpoint path, optional query parameters, headers, and sometimes a JSON payload. Query parameters are added to the URL to narrow results or control output, such as ?status=active&page=2. Headers communicate request-level details like content type, which is often application/json for requests that send a body. JSON request bodies should stay focused on resource fields and reflect the method being used: full resource data for PUT, changed fields only for PATCH, and create fields for POST. This structure keeps request examples reusable and easy to compare across methods.
Common questions about request examples
What belongs in the URL versus the JSON body?
Use the URL path for the resource itself and use query parameters for read filters or modifiers. Put resource data in the JSON body when the method creates or changes a record.
When should headers be shown?
Show headers when they add meaning to the request format, especially content type for JSON payloads. Keep the focus on request structure rather than unrelated setup details.
How do PUT and PATCH differ in the examples?
PUT is shown as a full replacement of the resource representation, while PATCH is shown as a partial update with only the fields that change.
Should every request example include a body?
No. GET and DELETE examples are often clearer without a body, while POST, PUT, and PATCH usually demonstrate a JSON payload.