The Litmus API will return exceptions (or errors) when something goes wrong. Let's say, for example, you attempted to DELETE a test:
$ curl -u api_key:api_pass -X DELETE https://sandbox.litmusapp.com/test_sets/4282
The Litmus API doesn't support DELETE requests to tests, so an exception is thrown, this appears as an XML response:
<?xml version="1.0" encoding="UTF-8"?>
<error>
<error_type>LitmusException::NotImplementedException</error_type>
<message>The Litmus API was unable to process your request. This version of the Litmus API does not support DELETE requests for tests. Please consult the API documentation for futher help with the error: LitmusException::NotImplementedException</message>
</error>
The table below should help you if you receive one of these error message.
| Exception type |
Details |
| LitmusException::NotImplementedException |
You're attempting to request a resource that doesn't exist, or requesting an existing resource with an unsupported request method. See the error message for further details. |
| LitmusException::NoURLSpecifiedForPageTest |
You've POSTed XML to create a page test, but failed to provide a URL. |
| LitmusException::NoTestTypeSpecifiedForTest |
You've POSTed XML to create a new test, but failed to provide a test type. |
| LitmusException::NoValidResults |
You've POSTed XML to create a new test and included a results block but none of the results provided are valid. Please provide at least one valid result containing a valid application_code. |
| LitmusException::InvalidXML |
Your POSTed/PUT XML failed to parse. Check its validity. Often this is thrown if you don't set the content type properly. |
| LitmusException::InvalidTestID |
The test ID you have requested could not be found. It may be that the test does exist but the account you're authenticating with does not have access to it. |
| LitmusException::UnknownService |
The test type supplied does not match any services offered by the Litmus API. A common cause of this error is using 'mail' when the test type should be 'email'. |
| LitmusException::TestValidationFailed |
Although the data provided was accepted, the test could not be created. This is nearly always because the URL provided for a page test is invalid. |
| LitmusException::UnknownError |
We're sorry, but for some reason the API stopped processing your request suddenly. We're notified if this error is ever thrown and will look into the problem and fix it as soon as we can.
|
| LitmusException::AccessDeniedException |
Your login credentials are not recognised by the Litmus API. Please contact support at hello@litmusapp.com so we can investigate. Let us know the api key and describe what you were trying to do, including the URL you were trying to access. We may need to ask you for your password or reset your password to a new one. |