Anatomy of a Uniform Resource Identifier (URI & URL)
Defined by Tim Berners-Lee and standardized in RFC 3986, a Uniform Resource Identifier (URI) provides a universal syntax for identifying abstract or physical resources across the Internet. A Uniform Resource Locator (URL) is a subset of URI that specifies not only the resource identity but also the exact protocol and network location required to retrieve it.
A complete modern URL is structured into seven distinct architectural components:
Query Strings vs Path Parameters in API Design
| Feature | Path Parameters (/users/:id) | Query Parameters (?filter=active) |
|---|---|---|
| Primary Role | Identifies a specific resource or entity in the database hierarchy. | Modifies, filters, sorts, or paginates how the resource is returned. |
| Requirement | Mandatory for locating the target endpoint. | Optional with fallback default values (e.g. limit=20). |
| Example Usage | GET /api/v1/orders/9482 | GET /api/v1/orders?status=shipped&sort=desc |
How URL Percent-Encoding (URL Encoding) Works
URLs may only contain characters from the US-ASCII character set. Characters that have special syntactic meaning (such as ?, &, =, #, /, :) or non-ASCII characters (e.g. spaces, emojis, accents) must be percent-encoded:
- Space $\rightarrow$
%20(or+in application/x-www-form-urlencoded query strings) - Ampersand (
&) $\rightarrow$%26 - Question Mark (
?) $\rightarrow$%3F - Forward Slash (
/) $\rightarrow$%2F
Frequently Asked Questions (FAQ)
Is the URL Fragment / Hash sent to the web server?
No. Everything following the # character (e.g. #section-2) is processed exclusively client-side by the browser for document scrolling or Single Page Application (SPA) client-side routing. It is never included in the HTTP request payload sent across the network.
What is the maximum allowed length of a URL?
While HTTP specifications do not set a strict maximum URL length, most browsers (Chrome, Firefox, Safari) and web servers (Nginx, Apache) safely support URLs up to 2,048 characters. Sending larger payloads should be done via HTTP POST request bodies with JSON instead.