← HTTP & APIs

Software Knowledge → 03 · HTTP & APIs → Path Parameter

PART III · HTTP & APIs

Path Parameter

A value placed inside a URL path to identify a specific resource.

01 · What is it?

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.

02 · Think of it like...

Think of it like...

Think of an address inside a building.

The endpoint identifies the area.

The path parameter identifies the exact item.

Orders→Order 1001
03 · What does it do?

What does it do?

Path parameters commonly identify:

Order IDOne specific order.
Customer IDOne specific customer.
Product IDOne specific product.
User IDOne specific user.
File IDOne specific file.
Other Specific ResourcesAny uniquely identified object.
04 · Where is it used?

Where is it used?

Path parameters are commonly used in REST APIs.

Retrieve One RecordGet one specific resource.
Update One RecordChange one specific resource.
Delete One RecordRemove one specific resource.
View One ResourceOpen the details of one object.
05 · Example

Example

Use:

GET /api/orders/1001

Break down:

/api/orders
Resource path

1001
Path parameter

Meaning: Retrieve order 1001.

Second example:

DELETE /api/orders/1001

Meaning:Delete order 1001.

06 · How it connects

How it connects

Resource Endpoint→Path Parameter→Specific Resource

Example:

/api/orders→1001→Order 1001
07 · Do Not Confuse

Do Not Confuse

Path Parameter ≠ Query Parameter

Path Parameter

Usually identifies a specific resource.

/api/orders/1001

Query Parameter

Usually filters or controls a request.

/api/orders?status=completed
Path Parameter = Which resource
Query Parameter = How to filter or control the request
08 · Topic Glossary

Topic Glossary

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资源 IDA 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.通常用来筛选或控制请求的参数。
URLURL 地址The full address containing the path.包含资源路径的完整网络地址。
Route路由Backend mapping that may read the path parameter.后端根据 URL 路径匹配处理逻辑的规则。
Order ID订单 IDA value used to identify one specific order.用来唯一标识某一张订单的值。
09 · What to Remember

What to Remember

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

↑