JMARyA
064dc6c5d3
All checks were successful
ci/woodpecker/push/validate_schema Pipeline was successful
15 lines
No EOL
955 B
Markdown
15 lines
No EOL
955 B
Markdown
# URL Suffix API
|
|
When designing a website, consider leveraging URL suffixes to indicate the format of the resource being accessed, similar to how file extensions are used in operating systems.
|
|
|
|
For example, a webpage located at `/blog/post/id` that renders human-readable content could have its machine-readable data served by appending a format-specific suffix to the same URL, such as `/blog/post/id.json`.
|
|
|
|
#### Benefits:
|
|
|
|
1. **Intuitive API from Website Usage**
|
|
Users can easily derive API endpoints from existing website URLs by appending the desired format suffix.
|
|
|
|
2. **Interchangeable Formats**
|
|
The same approach allows for multiple formats (e.g., `.json`, `.msgpack`, `.protobuf`) to be supported seamlessly, improving flexibility and usability.
|
|
|
|
|
|
This method simplifies the architecture, enhances consistency, and provides an elegant mechanism to serve both human-readable and machine-readable content from the same base URL. |