Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

SEO Metadata
titleResponse Body - errors

 

The body of the API's HTTP response is XML describing either the errors encountered, or the result of a successful request.

All response bodies contain a 'response' tag with a 'processed_date' attribute. The results are contained within the 'response' tag. The 'processed_date' attribute contains the date that the request was processed by the server, in ISO 8601 format.

An error response body might look like this:

Code Block
themeRDark
languagexml
linenumberstrue
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE response PUBLIC
"-//textmarketer.co.uk//DTD Web Services REST 1.6//EN"
"http://api.textmarketer.co.uk/services/rest/DTD/errors.dtd">
<response processed_date="2011-04-12T14:02:00+01:00">
<errors>
	<error code="404">Not Found (ERR255)</error>
</errors>
</response>

You can see that the XML above contains a list of errors - in this case only one. The error codes will be specific to the nature of the error. In this case we attempted to access a resource that doesn't exist. So the error code is the same as the response header status code 404, meaning 'resource not found'. However error codes are sometimes specific to the resource being called. For example, the sms resource might return errors like this:

Code Block
themeRDark
languagexml
linenumberstrue
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE response PUBLIC
"-//textmarketer.co.uk//DTD Web Services REST 1.6//EN"
"http://api.textmarketer.co.uk/services/rest/DTD/errors.dtd">
<response processed_date="2011-04-12T14:12:04+01:00">
<errors>
	<error code="10">invalid number or not an integer</error>
	<error code="9">invalid number or too short</error>
	<error code="7">invalid message or missing</error>
	<error code="4">invalid originator or missing</error>
</errors>
</response>

In this case, no data was passed to the resource except for the username and password. The errors therefore describe problems with the data passed, like the 'message' parameter is missing.
The error codes below 200, and all error messages, are specific to the resource and are detailed further below.

DTD

The DTD of the error response is included below for your reference.

Code Block
themeRDark
languagexml
linenumberstrue
<?xml version="1.0" encoding="UTF-8"?>
<!--
 	PUBLIC ID : -//textmarketer.co.uk//DTD Web Services REST 1.6//EN
	SYSTEM ID : http://api.textmarketer.co.uk/services/rest/DTD/errors.dtd
-->
<!ELEMENT response (errors)>
<!ATTLIST response
 processed_date CDATA #REQUIRED
>
<!ELEMENT errors (error?)>
<!ELEMENT error (#PCDATA) >
<!ATTLIST error
 code CDATA #REQUIRED

>