
/api/ to separate them from other URLs like HTML views served on the same server./api/:v. The version path component should come right after the api path component.v1 and go straight to v2.null for the value.Authorization header to consume protected endpoints. See the Auth section for more information on how to handle authorization and authentication.Authorization to authorize:Accept-Language should be used to indicate the client's language towards the API.data for successful requests with meaningful response data and error for unsuccessful requests with error data being returned.data key:error key:data or error):200 with an empty collection instead of e.g. 204 with no body.200 with empty collections:204 for empty collections.null or unset keys that are not setnull or don't include them. Do not use empty objects or empty strings.null:200 -> OK, used when on GET request with successful response201 -> Created, used on POST creating a record in DB202 -> Accepted, used when request has been received, but processed async204 -> No Content, used when no response is send, e.g. on DELETE301-> Moved Permanently, used if the resource has been moved to another URI304 -> Not Modified, used if If-Modified-Since header is send and nothing has changed since400 -> Bad Request, used when request cannot be processed, remember to give more info401 -> Unauthorized, used when authorization session is invalid or missing403 -> Forbidden, used when a route / entity was requested, but users access level does not permit it404 -> Not Found, used when a route / entity was not found405 -> Method Not Allowed, used when a route was hit with wrong method409 -> Conflict, used when an entity conflicts with another entity, e.g. duplicate entities / IDs422 -> Unprocessable Entity, used when validation rules on POST/PATCH/PUT are not followed429 -> Too Many Requests, used when you want to rate limit your API500 -> Internal Server Error, used for undefined server errors, should store a record in an bug tracking tool like Bugsnag, Crashlytics, Rollbar, New relic501 -> Not Implemented, used when you want to indicate that the feature/functionality is not implemented (yet)502 -> Bad Gateway, used when an internal service was not reachable, e.g. in micro service architecture503 -> Service Unavailable, used when an external service was not reachable, e.g. twilio.com504 -> Gateway Timeout, used to indicate that a request timed out (e.g. third party service took too long)Posted Jun 27, 2024
Created ValetTechs ValetApi