Introduction
This information will be helpful for developers who want to use the feature set of forismatic website in their own software products.
API method calls are implemented in the form of HTTP requests to the URL
http://api.forismatic.com/api/1.0/. Query parameters are passed using POST or GET (URL-encoded) method. The server return data format is set by the query parameter. The following response formats are supported:
http://api.forismatic.com/api/1.0/. Query parameters are passed using POST or GET (URL-encoded) method. The server return data format is set by the query parameter. The following response formats are supported:
- xml
- json
- jsonp
- html
- text
getQuote Method
Selects a random quote using passed numeric key, if the key is not specified the server generates a random key. The key influences the choice of quotation. Request parameters:
- method=getQuote — method name to invoke
- format=<format> — one of the server supported response formats
- key=<integer> — numeric key, which influences the choice of quotation, the maximum length is 6 characters
- lang=<string> — response language ("ru" or "en")
- jsonp=<string> — callback function name, used for jsonp format only (usage example)
Query example:
POST:
method=getQuote&key=457653&format=xml&lang=en
response:
<forismatic>
<quote>
<quoteText>Brevity — the soul of wit</quoteText>
<quoteAuthor></quoteAuthor>
<senderName>name or nickname of the quote sender</senderName>
<senderLink>email or website address of the quote sender</senderLink>
</quote>
</forismatic>
method=getQuote&key=457653&format=xml&lang=en
response:
<forismatic>
<quote>
<quoteText>Brevity — the soul of wit</quoteText>
<quoteAuthor></quoteAuthor>
<senderName>name or nickname of the quote sender</senderName>
<senderLink>email or website address of the quote sender</senderLink>
</quote>
</forismatic>