GuidesAPI Reference
DocumentationLog In

Errors

Bison Trails’ APIs attempt to follow a standard convention for error handling and reporting. Server errors, and errors generated before the API service receives a request, are reported using standard HTTP Response Codes. Supplemental details may be included in the response Body. Errors returned by APIs usually map to the appropriate HTTP Response Codes, otherwise they are a generic 400. In addition to the response code, the response Body is a JSON object with supplemental details of the form: { ‘message’: ‘error message’ }. Error messages are intentionally sanitized to avoid revealing sensitive information or implementation details.

Standard Response codes:

200OKEverything is working
201OKNew resource has been created
204OKThe resource was successfully deleted
304Not ModifiedThe client can use cached data
400Bad RequestThe request was invalid or cannot be served. The exact error should be explained in the error payload. E.g. "The JSON is not valid"
401UnauthorizedThe request requires a user authentication
403ForbiddenThe server understood the request but is refusing it or the access is not allowed.
404Not foundThere is no resource behind the URI.
422Unprocessable EntityShould be used if the server cannot process the entity, e.g. if an image cannot be formatted or mandatory fields are missing in the payload.
500Internal Server ErrorAPI developers should avoid this error. If an error occurs in the global catch blog, the stack trace should be logged and not returned as in the response.