Microsoft Link
https://learn.microsoft.com/en-us/azure/architecture/best-practices/api-design#define-restful-web-api-methods
/customers
{POST:Create a new customer,GET:Retrieve all customers, PUT Bulk update of customers, DELETE Remove all customers}
/customers/1
{POST:Error,GET:Retrieve the details for customer 1, PUT Update the details of customer 1 if it exists, DELETE Remove customer 1}
/customers/1/orders
{POST:Create a new order for customer 1,GET:Retrieve all orders for customer 1, PUT Bulk update of orders for customer 1, DELETE Remove all orders for customer 1}
When to use Path Params
Path Params
Use when: identifying a specific resource.
GET /users/123/orders/456 - Meaning: get order 456 for user 123
When to use Query Params
Query Parameters (?key=value)
Use when: you want to filter, search, or modify how data is retrieved (but not identify which data).
Filtering (?status=active)
Pagination (?page=3&limit=20)
Sorting (?sort=name)
Searching (?q=concert)
Do not send sensitive data in this
Request Body
Use when: sending data to create or update a resource.
POST /events
Content-Type: application/json
{
“name”: “Coldplay Concert”,
“date”: “2025-12-10”,
“venue”: “London Arena”
}
Good for - POST, PUT, PATCH requests. Complex or structured data (JSON, XML, etc.)
Do not use in GET - Browsers may ignore it
Headers
Use when: sending metadata about the request, not the resource data itself.
Authentication (Authorization)
Content type (Content-Type, Accept)
Custom client info (X-Client-Version, etc.)