Error Handling

When the Zenfolio server determines that it cannot handle an API request, it reports an error.

In SOAP, errors are returned in the Fault element:

HTTP/1.1 200 OK<cr><lf>
Content-Type: text/xml; charset=utf-8<cr><lf>
Content-Length: 234<cr><lf>
<cr><lf>
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <soap:Fault>
      <faultcode>{http://www.zenfolio.com/api}E_NOSUCHOBJECT</faultcode>
      <faultstring>There is no such photo.</faultstring>
      <detail />
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

The faultcode element contains a formal error code that can be used by the application to handle the error. The full list of error codes is provided in the Error Codes section.

The faultstring element contains a free-form string describing the error which can be useful for debugging. Your application should never use this string to display error messages to end users as it is not localizable and in general makes no sense to the user.

In JSON-RPC, error information is returned in the error field of the response object:

HTTP/1.1 200 OK<cr><lf>
Content-Type: application/json; charset=utf-8<cr><lf>
Content-Length: 234<cr><lf>
<cr><lf>
{
  "id": 1,
  "error": {
    "code": "E_NOSUCHOBJECT",
    "message": "There is no such photo."
  },
  "result": null
}

Similar to the SOAP response, the code field contains the error code and the message filed contains the error description.

Index