What is it?
A path parameter is a value placed directly inside a URL path.
It is commonly used to identify one specific resource.
Simple Definition:
A path parameter tells the API exactly which resource you want.
Software Knowledge → 03 · HTTP & APIs → Path Parameter
A value placed inside a URL path to identify a specific resource.
A path parameter is a value placed directly inside a URL path.
It is commonly used to identify one specific resource.
Simple Definition:
A path parameter tells the API exactly which resource you want.
Think of an address inside a building.
The endpoint identifies the area.
The path parameter identifies the exact item.
Path parameters commonly identify:
Path parameters are commonly used in REST APIs.
Use:
GET /api/orders/1001Break down:
/api/orders
Resource path
1001
Path parameterMeaning: Retrieve order 1001.
Second example:
DELETE /api/orders/1001Meaning:Delete order 1001.
Example:
Path Parameter ≠ Query Parameter
Usually identifies a specific resource.
/api/orders/1001Usually filters or controls a request.
/api/orders?status=completed| ENGLISH TERM | 中文 | SIMPLE ENGLISH | 中文小白理解 |
|---|---|---|---|
| Path Parameter | 路径参数 | A value inside a URL path used to identify a resource. | 放在 URL 路径中、用来标识具体资源的参数。 |
| Path | 路径 | The part of a URL that identifies where a resource is located. | URL 中用来定位资源的位置部分。 |
| Resource | 资源 | The data or object being identified. | Path Parameter 所指向的数据或业务对象。 |
| Resource ID | 资源 ID | A unique value used to identify one resource. | 用来唯一标识某个具体资源的值。 |
| Endpoint | 接口地址 | The API address containing the path parameter. | 包含路径参数的 API 访问地址。 |
| Query Parameter | 查询参数 | A parameter usually used to filter or control a request. | 通常用来筛选或控制请求的参数。 |
| URL | URL 地址 | The full address containing the path. | 包含资源路径的完整网络地址。 |
| Route | 路由 | Backend mapping that may read the path parameter. | 后端根据 URL 路径匹配处理逻辑的规则。 |
| Order ID | 订单 ID | A value used to identify one specific order. | 用来唯一标识某一张订单的值。 |
Path parameters identify specific resources.
They are part of the URL path.
Path parameters and query parameters serve different purposes.
Final:
Resource Path + Path Parameter = Specific Resource