If a call to an POS API endpoint fails, error information is returned in the API JSON response.As there are some situations where an API client can respond to an error – e.g. by gathering and supplying additional parameters, or correcting invalid input – the API defines formal error codes that can be examined by the client. These error codes are supported as part of the formal API, so API clients can rely upon them across POS versions.
The JSON error response looks like the following:
"message": "Custom error message...",
The error code is supplied in the
errors/extensions/code value. Other values may be helpful while developing an API client, but typically should not be used:
messageindicates more information about the error; however this is rarely suitable for display to an end-user.
locationsindicates where in the GraphQL request that led to the error.
pathindicates the endpoint path.
Additional error details may be provided for some error code types in the
Formal Error Codes
The POS API supports a list of common, formal error codes that your API client may choose to handle. This list is formally supported and is part of the public POS API.
There are several errors that may be returned by any POS feature:
- A generic error occurred, usually representing an unexpected condition or state.
- The caller is not able to do much with this type of error, except log and/or report the error to the end user.
- The endpoint requires authentication, and the caller is not currently authenticated.
- Ensure the caller is authenticated and retry the request.
- While the caller is authenticated, the endpoint requires permission(s) that the caller does not possess.
- Consider granting the required permission to the caller.
- The endpoint operation cannot proceed as POS is not configured correctly.
- One or more input parameters do not have the correct data format.
- Examples include:
- Passing an incorrectly formatted DateTime value, including a blank string.
- Passing an incorrectly formatted number, including a blank string.
- One or more input parameters to the endpoint failed validation.
- Additional error information is available in the error response:
extensions/data/ValidationTypeindicates the type of validation that failed.
extensions/data/Propertyindicates the name of the input property that failed validation.
sinceparameter was passed to the API endpoint, but is not correctly formatted for that endpoint.
- Never generate your own
sincevalues; only use the values that are return in the
untilresult of POS endpoints.
- The request failed because a system component is currently not available.
- The request can be retried later.
Gift Card Errors
The Gift Card module can return several types of errors:
- A gift card could not be identified by the supplied code, as the code matches multiple gift cards.
- The caller must also supply the code type.
- A supplied gift card code in an add or edit operation is already used by another gift card.
- The supplied card code has expired, and can no longer be used.
- The supplied code does not match an active gift card.
- The supplied internal ID does not match an active gift card.
- The supplied gift card PIN is invalid, or a PIN is required but has not been supplied.
- A gift card does not have sufficient funds to perform the specified transaction.
- An attempt was made to redeem points for a gift card, but the requested dollar amount was less than the minimum amount configured in POS settings.
- An attempt to capture or cancel a gift card transaction failed because the transaction was already cancelled.
- An attempt to capture or cancel a gift card transaction failed because the transaction was already completed.
- The supplied internal ID did not match a gift card transaction.
Other Supported Errors
- A general error occurred with the Acumatica integration.
- AWS integration is not configured correctly.
- An operation involving the BridgePay payment processor failed.
- A supplied ID or code does not match a customer record.
- A supplied ID or code does not match a store record.
- Data imported by the sync process is not properly formatted.
The API may also return other errors that are not in the formal list above. These types of errors typically correspond to incorrect program code, operation or misconfiguration.
API clients should not attempt to parse unsupported error codes – or error messages – as these are subject to change with new versions of POS.
Handling non-supported error codes or messages may break API clients as new versions of POS are released. Only base error handling on the supported list of error codes defined above.
API clients are encouraged to log these errors and display friendly error messages to end users, if applicable.