Location header
The response header that gives an address: where a newly created resource lives, where a job can be watched, or where a redirect points.
In more detail
A replayed create with the same idempotency key must return the original Location, not a new one. Its value can be a full address or a path relative to the request.
Example
In the APIs course: The course service answers POST /tasks with 201 and Location: /tasks/5, and POST /jobs with 202 and Location: /jobs/1.Related terms
- 201 Created — The HTTP status meaning a new resource was created, normally with a Location header saying where it lives.
- 202 Accepted — The HTTP status meaning the request was accepted for processing but the work has not finished yet.
- HTTP redirect — A 3xx response telling the client that what it wants is at another address, given in the Location header.
- job resource — A resource that represents long-running work, answered with 202 Accepted and a Location the client can poll for progress and the result.
Taught in
- HTTP Methods And Status Codes — Modern API Architecture: REST, GraphQL & gRPC
- Actions That Do Not Fit CRUD — Modern API Architecture: REST, GraphQL & gRPC
- Idempotency Keys — Modern API Architecture: REST, GraphQL & gRPC