Handling Responses from SimpleUPC

SimpleUPC send a standardize response to every request, successful or not. It will always consist at least a field to indicate whether or not the operation was successful.

Successful Responses:

Successful responses will typically send the result of their operations in a field called result or results (depending on whether the method returns a single or multiple results).

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <success>true</success>
    <usedExternal>false</usedExternal>
    <result>
/* NOTE: Rest of response is omitted in example */
</response>
Unsuccessful Responses:
XML:
<response>
    <success>false</success>
    <error>
        <code>1</code>
        <message><![CDATA[API Key Not Recognized]]></message>
    </error>
</response>
JSON:
{
    "success" : false,
    "error" : {
        "code" : 1,
        "message" : "API Key Not Recognized"
    }
}

    Notes:

  • By default, responses will be sent back in the same format that they are requested.
  • Generally, error codes are 1-2 digits indicating the problem.
  • If the issue arose from the method not being able to complete, the error code will be 4 digits, beginning with “40”.
  • A summary of all error codes, their descriptions and meanings, can be found here.