Welcome to the Sententia API v0.1.4 alpha

This site includes a short documentation, as well as examples and simple test sets for the API of sententia.eu quotes database.

Our suggestions box is open at all times. The API is made for you so please let us know, if we can make something better.

Status: unknown

Documentation

Base URI: http://api.sententia.eu

All API requests start with the base URI. The next segment of the URI depends on the type of the request - listed below in the resources section.

Currently a SSL connection over HTTPS is not possible.

REST(ful)

The API's engine is based on the codeigniter-restserver - a fully RESTful server implementation.

Method

All requests should be made with the GET method.

Resources

GET /latest

Returns the latest quote with author (if information available).
{"text":"Bestest quote ever.", "author":"Author"}

GET /random

Returns one random quote with author (if information available).
{"text":"Randomest quote ever.", "author":"Author"}

Languages

You can choose the language by adding a lang parameter.
?lang=english
/lang/en/
E.g.: /latest?lang=english or /random/lang/polish/

Available languages:

  • german
  • english (default)
  • latin
  • polish

Formats

You can specify the format in two ways. Adding e.g. .xml or adding e.g. ?format=xml.
  • json => 'application/json' (default)
  • jsonp => 'application/javascript'
  • xml => 'application/xml'
  • serialized => 'application/vnd.php.serialized'
  • php => 'text/plain'
  • html => 'text/html'
  • csv => 'application/csv'

Charset

All requests should be coded in the UTF-8 charset. All responses are returned in UTF-8 charset as well.

Authentication

Currently no authentication is needed. Depending on the traffic and load a simple HTTP basic authentication or digest authentication may be implemented.

Limits

Currently no limits are enabled. Depending on the usage and load volume hourly limits for each resource might be introduced.

Response codes

The response header includes a response code. Here are listed the possible response codes together with a description.
  • 200 OK - Request has been performed correctly.
  • 400 Bad Request - A parameter has an invalid value or the value is not in the defined set.
  • 401 Unauthorized - No authorization or access to the resource. IP is probably denied.
  • 404 Not Found - The resource was not found or does not exist.
  • 406 Not Acceptable - Only AJAX requests are accepted.
  • 500 Internal Server Error - The code returned in case of an internal server error.
  • 503 Service Unavailable - The API is currently under maintenance or offline. If under maintenance the Retry-After header includes the scheduled end time of service unavailability as RFC 1123 HTTP date (GMT).

Examples

Test

Latest quote

Click here to retrieve the latest quote - get a JSON response with an jQuery AJAX request and process it
$.ajax({
    url: 'http://api.sententia.eu/latest',
    dataType: 'json',
    success: function (d) {
        alert('Successful AJAX request!\nLatest quote:\n' + d.text);
    },
    error: function(d, s, e) {
        alert(e + '\nOh no! A problem with the AJAX request occurred.\n' + d.responseText);
    }
});