Errors

If an API request is unsuccessful, you will encounter errors in the form of HTTP response codes. The types of error codes can be either client-related or server-related, and they can be generic or customised for Advantus.

A list of common error responses along with their explanation is given below:

HTTP Status CodeStatusDefinition
400Bad RequestBad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, or deceptive request routing)
401UnauthorizedThis response status code indicates that the client request has not been completed due to invalid authentication credentials for the requested resource.
403ForbiddenThis response status code indicates that the server understands the request but refuses to authorize it.
404Not FoundThis response status code indicates that the server cannot find the requested resource. Links that lead to a 404 page are often called broken or dead links and can be subject to link rot. A 404 status code only indicates that the resource is missing: not whether the absence is temporary or permanent.
405Method Not Allowed405 Method Not Allowed error occurs when the web server is configured in a way that does not allow you to perform a specific action for a particular URL.
500Internal ServerThis response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.
502Bad GatewayThis response code indicates that the server while acting as a gateway or proxy, received an invalid response from the upstream server.
503Service UnavailableThis response code indicates that the server is not ready to handle the request. Common causes include a server that is down for maintenance or that is overloaded.

Advantus leverages HTTP-based codes that are received in response to any API calls made throughout the application.

These code responses can be of various types:

  • success response
  • client-side error or
  • server error in some cases

An easy way to understand them is-

  • Responses in the 200 range represent success.
  • Responses in the 400 range represent information or an input-related error.
  • Responses in the 500 range indicate an error with the server.

This document will guide you through a basic structure of responses. Some responses will have a brief explanation along with them in the form of a string code.

However, there may be certain exceptions to the rule, based on specific code libraries that generate their own error responses.

{ "success": False, "message": error['error_message'], "error_code": error['error_code'] "data": data }

Attributes

AttributeExplanationDatatype
successThis will return true or falseboolean
messageA human-readable message providing more details about the error. For card errors, these messages can be shown to your users.string
error_codeFor some errors that could be handled programmatically, a short string indicating the error code is reported.integer
dataThis will return dataobject

ON THIS PAGE