input stringlengths 46 184 | label stringlengths 8 30 | note stringlengths 46 168 |
|---|---|---|
Request for /users/123/posts/456 where user 123 doesn't exist. | 404 Not Found | The specific resource (post 456) cannot be found because its parent (user 123) does not exist, making the entire path invalid. |
Request body is malformed JSON (syntax error). | 400 Bad Request | The server cannot parse the request payload due to incorrect syntax. |
Attempting to access a protected resource without providing any authentication credentials. | 401 Unauthorized | The request lacks valid authentication credentials for the target resource. |
An authenticated user tries to access a resource they are not permitted to view or modify. | 403 Forbidden | The server understood the request but refuses to authorize it, even if authentication was provided. |
Request for /products/999 where product 999 does not exist. | 404 Not Found | The requested resource could not be found on the server. |
Attempting to use a POST request on an endpoint that only supports GET (e.g., /api/status). | 405 Method Not Allowed | The method specified in the request line is known by the origin server but not supported by the target resource. |
Sending a request with Content-Type: application/xml to an API that only accepts application/json. | 415 Unsupported Media Type | The origin server or gateway will refuse the request because the payload format is not supported by the target resource for this method. |
A client sends too many requests in a given amount of time, exceeding the API's rate limit. | 429 Too Many Requests | The user has sent too many requests in a given amount of time (rate limiting). |
An unexpected error occurs on the server while processing a valid request. | 500 Internal Server Error | A generic error message, given when an unexpected condition was encountered and no more specific message is suitable. |
The server is currently unable to handle the request due to temporary overloading or maintenance. | 503 Service Unavailable | The server is not ready to handle the request, often due to being down for maintenance or being overloaded. |
Creating a new user account with a request body that omits the mandatory 'username' field. | 400 Bad Request | The request could not be understood by the server due to malformed syntax, specifically a missing required parameter. |
Attempting to create a product with a 'price' field set to a negative value. | 400 Bad Request | The server cannot process the request because a specific field contains an invalid or out-of-range value. |
Attempting to create a resource (e.g., a user with a unique email) that already exists. | 409 Conflict | The request could not be completed due to a conflict with the current state of the target resource, such as a unique constraint violation. |
Updating a resource with an If-Match header that specifies an ETag that no longer matches the current resource version. | 412 Precondition Failed | The server does not meet one of the preconditions that the requester put on the request header fields. |
Requesting a resource that was previously available but has been permanently deleted and will not be available again. | 410 Gone | The requested resource is no longer available at the server and no forwarding address is known. |
The client uses an HTTP protocol version that the server does not support. | 505 HTTP Version Not Supported | The HTTP version used in the request is not supported by the server. |
A server acting as a gateway or proxy did not receive a timely response from an upstream server. | 504 Gateway Timeout | The server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed to access in order to complete the request. |
An authenticated request is made with an access token that has expired or is otherwise invalid. | 401 Unauthorized | The provided authentication token is either expired, revoked, or otherwise invalid. |
Requesting /products?page=abc where 'page' is expected to be an integer. | 400 Bad Request | A query parameter has an invalid format or value, preventing the server from fulfilling the request. |
Uploading a file or sending a request body that exceeds the server's configured maximum size limit. | 413 Payload Too Large | The request entity is larger than limits defined by server; the server might close the connection or return an Retry-After header field. |
The length of the URI (including query parameters) exceeds the server's capacity to interpret it. | 414 URI Too Long | The URI provided was too long for the server to process. |
A request is syntactically correct but contains semantic errors that prevent it from being processed (e.g., trying to move an item to a full inventory, or an invalid state transition). | 422 Unprocessable Entity | The server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions. |
Attempting to modify a resource that is currently locked by another process or user. | 423 Locked | The resource that is being accessed is locked. |
The client specifies an Accept header (e.g., application/xml) but the server can only generate application/json. | 406 Not Acceptable | The server cannot produce a response matching the list of acceptable values defined in the request's proactive negotiation headers (e.g., Accept header). |
Requesting an old URI for a resource that has been permanently moved to a new URI. | 301 Moved Permanently | The target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs. |
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
HTTP Status Code Guide for Ambiguous API Scenarios
This dataset provides guidance on selecting appropriate HTTP status codes in common, yet ambiguous, API development situations. It helps developers make consistent and semantically correct choices, improving API predictability and client integration.
25 rows · category: reference · licence: CC0-1.0 (public domain)
Usage
import http_status_guide # Assuming the module is saved as http_status_guide.py
scenarios = http_status_guide.load()
if scenarios:
print(f"Loaded {len(scenarios)} HTTP status code scenarios.")
print("\nFirst scenario example:")
print(f" Input: {scenarios[0]['input']}")
print(f" Label: {scenarios[0]['label']}")
print(f" Note: {scenarios[0]['note']}")
else:
print("No scenarios loaded. Check if 'data.jsonl' exists and is correctly formatted.")
Sample rows
{"input": "Request for /users/123/posts/456 where user 123 doesn't exist.", "label": "404 Not Found", "note": "The specific resource (post 456) cannot be found because its parent (user 123) does not exist, making the entire path invalid."}
{"input": "Request body is malformed JSON (syntax error).", "label": "400 Bad Request", "note": "The server cannot parse the request payload due to incorrect syntax."}
{"input": "Attempting to access a protected resource without providing any authentication credentials.", "label": "401 Unauthorized", "note": "The request lacks valid authentication credentials for the target resource."}
Files
| File | What |
|---|---|
data.jsonl |
the dataset, one JSON object per line |
tool.py |
stdlib-only loader and helpers |
test_tool.py |
tests that pass against the data |
Source: https://github.com/simalidudu-boop/http-status-ambiguity-guide
Support
This is free and public domain. If it saved you time, zap it: SharkSkin@coinos.io
Generated and maintained by an autonomous pipeline. Issues and PRs welcome.
- Downloads last month
- 30