BadAPI allows you to simulate misbehaving APIs. This is useful if your site relies on the availability of service X, and you want to ensure that any downtime experienced by that service has minimal impact on your own application.
Replace the HTTP endpoint URL for the API you wish to test with the URL 'http://badapi.trib.tv/req'. Append arguments to the URL query string parameters, as indicated below to control the bahaviour that you get from the API simulator. Arguments should be separated by ampersands (&) if you want to provide more than one argument, and should be URL encoded if necessary.
| Prefix | Format | Example | Description |
|---|---|---|---|
| wait | Integer | wait=25 | Causes the request to hang for the specified number of seconds before returning output. Useful for simulating sluggish response, or checking that timeouts behave as expected. Max 30 seconds. |
| resp | Integer | resp=500 | Causes the specified HTTP response status code to be used in the response, eg 500 Internal Server Error. Any valid HTTP response status code can be used. Invalid codes are ignored. |
| op | String | op=json1 | Specifies the output to send in response to the request. The choice of outputs is as shown below. |
| ct | String | ct=html | Specifies a content-type header to include in the response. Shortcuts are html (text/html), css (text/css), jpg (image/jpg), gif (image/gif), png (image/png), text (text/plain), xhtml (application/xhtml+xml), pdf (application/pdf), bin (application/octet-stream). Any unrecognised string will be used as given. |
| cs | String | cs=utf8 | Specifies a character set to include in the content-type header of the response. Shortcuts are utf (UTF-8), latin1 (ISO-8859-1), asc (US-ASCII), win1252 (windows-1252). Any unrecognised string will be used as given. |
| Keyword | Description |
|---|---|
| HDBBfcHfEGgn | gjMJlQ http://cry82Nqp94NsW0sl2VvqhJ4m.com |
| WZzKGAqWJMVPetwgkB | efOAjv http://fh82nGsQk0fQsn3Ldap1f.com |
| ccsKsQZHSBBihUqXo | yqRtFZHfMSczIK |
| errstring | A simple error message |
| fTUkoIjqGjK | hPblDGvrhADAHYDOIdD |
| jsdocwrite | A simple JavaScript document.write statement. This is intended to be used to test the ability to content management systems to embed script includes |
| json1 | Valid JSON test string, UTF-8 encoded with non-ASCII characters and Unicode escape sequences, spaced with tabs, newlines and spaces. |
| wcwKWdRtWNnoY | Best Site Good Work |
You can include anything in your response body, but stick to plain text for the description. If you include HTML, the submission will not be saved.
Created by Andrew Betts. Comments to andrew@trib.tv.