-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Add RESTful API to API documentation #2680
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
📝 WalkthroughWalkthroughA new file named Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Warning Rate limit exceeded@chronark has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 28 minutes and 59 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (3)
apps/www/content/glossary/restful-api.mdx (3)
6-6
: Consider populating the categories array.The categories array is currently empty. Consider adding relevant categories like "API", "Web Services", or "Integration" to improve content discoverability.
58-62
: Consider adding HATEOAS principle.The introduction provides a good overview of RESTful APIs, but it could be enhanced by mentioning HATEOAS (Hypermedia as the Engine of Application State) as it's a key principle of REST architecture.
Consider adding a sentence like:
RESTful APIs are inherently **stateless**, meaning each request from a client to a server must contain all the information needed to understand and complete the request. The server does not store any state about the client session, which enhances scalability by reducing server memory requirements. Communication between client and server occurs using standard HTTP protocols, with data typically returned in **JSON** or **XML** format. +Additionally, true RESTful APIs implement HATEOAS (Hypermedia as the Engine of Application State), where responses include links to related resources, enabling clients to dynamically discover available actions.
117-121
: Add query parameter examples for filtering and pagination.Since filtering and pagination were mentioned in the best practices, it would be helpful to include examples of these in the blog platform API design.
Consider adding these examples:
- **List all posts**: `GET /posts` +- **Filter posts**: `GET /posts?author=johndoe&category=tech` +- **Paginated posts**: `GET /posts?page=1&limit=10` - **Create a new post**: `POST /posts` - **Read a specific post**: `GET /posts/{id}` - **Update a post**: `PUT /posts/{id}` - **Delete a post**: `DELETE /posts/{id}`
- url: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm | ||
title: RESTful Web Services |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect URL for "RESTful Web Services" reference.
The URL points to Fielding's dissertation but the title suggests it should link to a different resource about RESTful Web Services.
Consider updating to a more appropriate URL that matches the title, or update the title to match the current URL's content: "Architectural Styles and the Design of Network-based Software Architectures".
question: What are the three principles for a RESTful API? | ||
- answer: "A RESTful API consists of three major components: 1) Client: This is the application or software code that sends requests to the server for a resource. 2) Server: This is the application or software code that controls the resource. It processes the client's requests and sends responses. 3) Resource: This is the data or service that the client requests. It can be any information that can be named, such as a document or an image. The client interacts with a representation of the resource, rather than the resource itself." | ||
question: What are the three components of a RESTful API? | ||
updatedAt: 2024-11-25T19:00:24.000Z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future date detected in updatedAt field.
The updatedAt timestamp is set to November 25, 2024, which is in the future.
Update the timestamp to reflect the current date or remove it to let the system manage this automatically.
```json | ||
GET /users/123 | ||
Response: | ||
{ | ||
"id": "123", | ||
"name": "John Doe", | ||
"email": "[email protected]" | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance API example with headers and status code.
The API example would be more complete with HTTP headers and status code information.
Consider updating the example to include these details:
GET /users/123
+
+HTTP/1.1 200 OK
+Content-Type: application/json
+
Response:
{
"id": "123",
"name": "John Doe",
"email": "[email protected]"
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
```json | |
GET /users/123 | |
Response: | |
{ | |
"id": "123", | |
"name": "John Doe", | |
"email": "[email protected]" | |
} | |
``` | |
```json | |
GET /users/123 | |
HTTP/1.1 200 OK | |
Content-Type: application/json | |
Response: | |
{ | |
"id": "123", | |
"name": "John Doe", | |
"email": "[email protected]" | |
} | |
``` |
Thank you for following the naming conventions for pull request titles! 🙏 |
This PR adds the RESTful API.mdx file to the API documentation.
Summary by CodeRabbit