Library OpenApi Overview About these APIs Architecture Authentication Error Responses Locating a Server Sessions Design Guides Guides and Hints Examples Pricing for Websites Accepting Vouchers PreAuth Payment Replication Common Apis The most used APIs Create New Sale Payment Completion Multiple Locations Delivery Addresses Create New Sale v2 Customers Locations Products Staff WebHooks eCommerce Apis These APIs are often used with eCommerce website integrations Get Pricing Card Inquiry Report & Analysis Grouped or analysed report data. Typically used to build reports and dashboards Today Login Access Pinboard ReportRequest Advanced Information More indepth information Caller Handling HTTP Protocol Bulk Data Downloads Document Uploading RetailConfig Under Development Details of APIs that will be available shortly. Documentation provided is for early adopters Get Receipt

Error Responses

When APIs have an error with the request data or cannot process for some reason they return an error packet.

{
  "error": {
    "Code": 2100,
    "Message": "Payment type of 'PaymentExpressPxPay' was not understood as a method of payment.  Check spelling?",
    "Severity": "Error"
  }
}

Contents of error Packet

Code
A numeric value indicating the type of error. IF you have error handlers they should be driven off this code field
Message
A technical message explaining the error. The message text is dynamic and can change value even for the same error, so checking for exact string match is not recommended. In the example above the work 'PaymentExpressPxPay' can vary according to what data you passed in. This Message value is primarily intended for technical users and will contain technical terminology.
UserMessage
Contains a suggested message to display to the user for this error. Only returned in special cases where a specific user message is suggested.
Severity
How critical the error is:
  • Error Bad. We cannot process.
  • Warning Something is wrong, or probably wrong, but we have worked around it or applied a default
  • Info Information type errors. For example 'Use deprecated, use xyz instead'
SqlState
The SqlState error code where available and relevant. This is typically only returned when the request is directly processed by the database layer.

Multiple Errors

When multiple errors are present, they are returned as an array of QERR objects. Fieldpine OpenApi does not return multiple errors very often, typically only in special cases, such as when you have set CallerHandling to "developer".

{
  "error": {
    "QERR": [
      {
        "Message": "The Sale.location value was not set or invalid.  The default location of the server is being used",
        "Severity": "Warning"
      },
      {
        "Code": 2100,
        "Message": "Payment type of 'PaymentExpressPxPay' was not understood as a method of payment.  Check spelling?",
        "Severity": "Error"
      }
    ]
  }
}

If you are writing a custom error handler you can process the response with code similar to the following:

function DisplayError(ErrorPacket) {
    if (typeof ErrorPacket.error === 'object') {

        // Check if valid Array
        if ((typeof ErrorPacket.error.QERR !== 'undefined') && (Array.IsArray(ErrorPacket.error.QERR))) {

            // Yes, multiple errors present
            var out = new Array;
            for (var ndx = 0; ndx < ErrorPacket.error.QERR.length; ndx++) {
                out.push(ErrorPacket.error.QERR[ndx].Message);
            }

            alert("The error messages are \n" + out.join("\n"));

        } else {

            // Only one error present
            alert("The error message is "+ErrorPacket.error.Message);
        }
    } else alert("This isn't an error packet!");
}

Error Codes

2003 RLERROR_INVALID_FIELD_VALUE
A value in a field is invalid and cannot be used.
2004 RLERROR_REQUIRED_FIELD_MISSING
A required field is missing or is present and empty
2007 RLERROR_SELECTION_CRITERIA_REQUIRED
No selection criteria were given and these are required.
2008 RLERROR_NO_RESULTS
The requested data does not exist.
2100 RLERROR_INVALID_PAYMENT_TYPE
Unrecognised or invalid payment type.