The HTTP Status Code API is a tool to help developers learn and understand HTTP status codes. It allows users to input a status code and returns a detailed message about what the code means. This API is particularly useful for students, new developers, and anyone trying to master HTTP communication.
GET /status-info?code=<status_code>
- code (required): The HTTP status code to query, sent as a query parameter.
A JSON object containing:
- The status code.
- A message explaining the meaning of the status code.
GET /assistant/greet?name=<user_name>
- name (required): The HTTP status code to query, sent as a query parameter.
A JSON object containing:
- The status code.
- A message explaining the meaning of the status code.
- 200 OK: Request was successful.
- 201 Created: A resource has been successfully created.
- 204 No Content: Request processed successfully, no content returned.
- 400 Bad Request: The request is invalid due to client-side errors.
- 401 Unauthorized: Authentication is required to access the resource.
- 403 Forbidden: Server refuses to authorize the request.
- 404 Not Found: The resource does not exist.
- 405 Method Not Allowed: HTTP method not supported for this resource.
- 429 Too Many Requests: User has exceeded rate limits.
- 500 Internal Server Error: The server encountered an error.
- 502 Bad Gateway: The server received an invalid response from the upstream server.
- 503 Service Unavailable: Server temporarily overloaded or under maintenance.
- 504 Gateway Timeout: The server did not receive a timely response from the upstream server.
{
"status": 200,
"message": "OK: The request has succeeded. The meaning of this status depends on the HTTP method used."
}{
"status": 404,
"message": "Not Found: The server has not found anything matching the request URI. This is often caused by a missing page or resource."
}{
"status": 500,
"message": "Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request."
}- Go to the repository on GitHub and click the Fork button at the top right of the page. This will create a copy of the repository in your own GitHub account.
- Once the repository is forked, click the Clone button and copy the link (HTTPS or SSH).
- Open your terminal/command prompt and run:
Replace
git clone <repository_url>
<repository_url>with the link you copied from your GitHub.
- Navigate to the cloned directory:
cd <repository_folder>
- Install all necessary dependencies mentioned in the
package.jsonfile:npm install
- Implement the API to respond with the correct status message based on the input status code.
- Test the API locally to ensure everything works properly.
- You can use Postman or visit the URL in your browser to see the output.
- Add your changes to git:
git add . - Commit your changes with a message:
git commit -m "Completed solution for Virtual Assistant API and Status Code API" - Push your changes to your GitHub repository:
git push origin main
- Once you have committed and pushed your changes, submit the GitHub repository link to your instructor.
- The link should be in the format:
https://github.com/<your_username>/<repository_name>
If your GitHub username is johnDoe and your repository is named http-status-api, the submission link would be:
https://github.com/johnDoe/http-status-api