API Docs


Documentation for the irkfdb API

General usage of an API

The facts about Rajinikanth are available at:

//api.irkfdb.in/facts

JSON Response

The default format of the JSON response is as follows. There are 2 keys in the JSON.
status - if all good, you will get the status as "OK".
resultSet - the second key in the JSON consists of multiple keys again out of which data would have the complete list of facts as an array.
Each fact in the data array consists of:
id: a unique id for each joke
fact: The fact about Rajinikanth
categories: The categories to which the fact belongs
sources: Sources where this fact was found.
There is another key with the name total_facts which are in the Database. This number ought to be changed since the cleaning of facts and removal of duplicates is in process on a daily basis.

{ "status": "OK", "resultSet": { "data": [{ "id": "8083f2d8a8f69fb33edeb62760b7d047", "fact": "Rajinikanth uses ribbed condoms inside out, so he gets the pleasure.", "categories": ["nsfw"], "sources": ["api.icndb.com"] }, .... // other facts if any ], "total_facts": 9361 }}

Random Fact

You can use the following API call to fetch the random fact of the database.
Note:Although this API endpoint returns a single fact, still the data in a resultSet would be an array.

//api.irkfdb.in/facts/random

Optional Parameters

All the following optional parameters work when used together for normal API call to fetch the facts or to fetch the random fact or an API call with the callback

Using callback functions

You can even pass the callback method in the URL and the complete result of the call would be passed to you as an argument.

//api.irkfdb.in/facts?callback=someJsFunction

Changing the name

Although its a foolish idea to replace your name with the Rajinikanth's name, but till he finds it out, you can take benefit of this feature. You can change name by simply passing 2 parameters firstName & lastName . This works for the normal API call to fetch the facts and even for the API call to fetch random facts. For this to work both the parameters firstName & lastName needs to be passed if any of this parameter is missing - Rajinikanth will take over.

//api.irkfdb.in/facts?firstName=Chuck&lastName=Norris//api.irkfdb.in/facts/random?firstName=Chuck&lastName=Norris

Fetching number of facts in a single call

By default the facts API call return 20 facts & the random API call returns single fact. But you can overcome the limitations by passing the optional query parameter to the api call limit

//api.irkfdb.in/facts?limit=5//api.irkfdb.in/facts/random?limit=2

Next "n" number of facts

Once you have fetched the first n number of facts, you can fetch the next n facts by passing the page parameter in combination with the limit parameter

//api.irkfdb.in/facts?limit=5 // first 5 facts - 0 to 5//api.irkfdb.in/facts?limit=5&page=2 // next 5 facts - 6 to 10

Categories & Facts filtered by categories

To fetch the categories under which the facts are mapped to

//api.irkfdb.in/facts/categories

Right now we have the following categories

  • nsfw - Not Safe For Work
  • geeky - Related to computers, science or maths
  • religion -
  • animal -
  • food -
  • political -
  • movie -
  • sport -
  • science -
  • celebrity -
  • travel -
  • money -
  • history -
  • career -
  • music -
  • chuck-only - Facts that can only work with Chuck Norris
We are planning to add more categories

Response JSON would be in the format as follows

{ "status": "OK", "resultSet": { "data": [ "nsfw", "geeky" ] }}

You can fetch the facts belonging to particular category by passing the optional parameter limitFactsTo and passing the category names comma separated

//api.irkfdb.in/facts?limitFactsTo=geeky//api.irkfdb.in/facts?limitFactsTo=geeky,nsfw

You can also exclude the facts belonging to particular category by passing the parameter excludeFactsFrom and passing comma separated category names

//api.irkfdb.in/facts?excludeFactsFrom=nsfw