General operation
The jokes are available at
https://api.icndb.com
Use HTTP GET to retrieve what you want (read on below for more details). Results can returned as raw JSON data (the default case) or using a JavaScript callback function for script communication.
JSON
In the default case, the result will always look like this:
{ "type": ..., "value": ... }
The type will be “success” on success and something else when something went wrong (more details below). An example of the result of a successful request:
{ "type": "success", "value": { "id": 268, "joke": "Time waits for no man. Unless that man is Chuck Norris." } }
Using callback functions
Next to returning raw JSON data, it is also possible to automatically feed the results into a callback function. This is useful for script communication in case regular XMLHttpRequest does not work.
To use a callback function, use the following GET parameter:
?callback=
The callback function will retrieve the parsed JSON as stated above.
Changing the name of the main character
The API permits changing the name of the main character when fetching a joke. To do this, use the following GET parameters:
?firstName= ?lastName=
Example: To retrieve one random joke with main character called “John Doe”, fetch the URL:
http://api.icndb.com/jokes/random?firstName=John&lastName=Doe
The result will be similar to before, for example:
{ "type": "success", "value": { "id": 268, "joke": "Time waits for no man. Unless that man is John Doe." } }
Escaping special characters
Some jokes contain some special characters such as “, & or <. These special characters can make it hard to show the joke correctly or can even skrew up the syntax of the result. To fix this, the API escapes special characters before returning the result. There are two options: HTML encoding or JavaScript encoding.
HTML encoding is the default. In this case, &, ” (double quotes), < and > are encoded in their respective HTML format (e.g., &). In this case, you can directly insert the resulting joke in an HTML page without errors.
With JavaScript encoding, only quotes (both double and single) are escaped. In this case, backslashes are added (e.g., “Chuck’s fist” becomes “Chuck\’s fist”). JavaScript encoding is only used when you request a joke with the following GET parameter:
?escape=javascript
Fetching a random joke
URL:
http://api.icndb.com/jokes/random
Result:
{ "type": "success", "value": { "id": , "joke": } }
Fetching multiple random jokes
URL:
http://api.icndb.com/jokes/random/<number>
Example:
http://api.icndb.com/jokes/random/3
Result:
{ "type": "success", "value": <value> }
Example:
{ "type": "success", "value": [ { "id": 1, "joke": "Joke 1" }, { "id": 5, "joke": "Joke 5" }, { "id": 9, "joke": "Joke 9" } ] }
Limiting categories
The jokes in the database are given categories such as “nerdy” or “explicit”. When fetching multiple jokes, it is possible to limit the scope to some of these categories or exclude some of them, as shown below. The list of categories can be retrieved as shown in one of the next sections.
To limit the jokes to certain categories, use the following GET parameter:
http://api.icndb.com/jokes/random?limitTo=Array
Example:
http://api.icndb.com/jokes/random?limitTo=[nerdy] http://api.icndb.com/jokes/random?limitTo=[nerdy,explicit]
Similarly, to exclude jokes from certain categories, use the following GET parameter:
http://api.icndb.com/jokes/random?exclude=Array
Example:
http://api.icndb.com/jokes/random?exclude=[nerdy] http://api.icndb.com/jokes/random?exclude=[nerdy,explicit]
Fetching a specific joke
URL:
http://api.icndb.com/jokes/<id>
Example:
http://api.icndb.com/jokes/15
Result and example: same as with random joke.
Fetching the number of jokes
URL:
http://api.icndb.com/jokes/count
Result:
{ "type": "success", "value": <count> }
Example:
{ "type": "success", "value": 549 }
Fetching the list of joke categories
URL:
http://api.icndb.com/categories
Result:
{ "type": "success", "value": <categories> }
Example:
{ "type": "success", "value": [ "nerdy", "explicit", "chuck norris", "bruce schneier" ] }
how is development going? :)
I have to be honest, not much going on for the moment… Having been busy a lot, but I will continue the project when I can. For the record: planned on adding more categories, increasing the number of jokes and developing the latest-jokes-function.
It’s really awesome
you get a specific joke part of the api is btw already working:
http://api.icndb.com/jokes/1
http://api.icndb.com/jokes/$jokenumber
Indeed. The reason I did not include this in the API documentation is the fact that I was still in doubt about the correct REST syntax for this: http://api.icndb.com/jokes/1 or http://api.icndb.com/jokes/id/1 I think I’m going for the first one, so nothing changes.
When you call the count it says 550 right now but there are jokes with an id over 550. That’s because there are some ids that aren’t assigned to a joke, and if you call them you get a fatal error. Could you fix this please?
Hi Richard,
Why is this a problem? I’ve though about this, but this would require shifting existing jokes to lower ids when a joke is removed. I chose to keep each joke at its original id.
could you give a method to get the highest id?
I could implement it very easily, but again: why do you need it? I want to keep the API as clean as possible, this method does not really fit in. Do you need it for traversing the jokes? In my opinion, the order should not really matter, so the random joke functionality should be enough. Am I mistaken?
Hello,
Just a thought :
http://api.icndb.com/jokes/latest
and/or
http://api.icndb.com/jokes/${category}/latest
and/or
http://api.icndb.com/jokes/latest?limitTo=Array
Yeah, good idea. I also thought about this myself, but the latest joke is only useful if jokes are continuously added to the database. Which does not happen at lot, unfortunately. Would you be interested to contribute? :)
I am interested to contribute :)
Good to hear :) See my reply on the comment below.
don’t mind the request, I will redo some stuff in the application and I won’t need it now. Thank you for replying though.
Hi, brilliant site. I used your DB in a learning experience and built an Android app for this…see Chuck Norris Jokes. Some of these jokes are cut off in the database. Is there any way to complete them? E.g. “Chuck Norris is expected to win gold in every swimming competition at the 2008 Beijing Olympics, even though Chuck Norris does not swim. This is because when Chuck Norris enters the water, the water gets out of his way and Chuck Norris simply walks across the”.
Hey,
Thanks for the reply, I appreciate you appreciating it :) About the joke: thanks for the bug report, I’ve removed four incomplete jokes.
If you have other remarks or questions, be sure to let me know!
This has got to be one of the neatest APIs. :)
Why, thank you :) As you can see, it is still far from finished at the moment, but it serves its purpose.
[…] Google search turned up The Internet Chuck Norris Database, a hilarious site which even contains a REST API! Great, so this means we can get a single joke back each time by writing appropriate […]
Hi,
As you’ve already noticed I’ve written a TFS 2010 build activity that will show a random Chuck Norris joke when a build is run. I hope this will make people run their builds more!
The blog post is here. Thanks for the great work!
Hi Yuval,
Yes, I’ve seen it, very cool! That’s exactly the purpose I set up the API for :) Thanks for the notice!
i’m using python, i’m a new user with it, and i was wondering how can i just get the joke to display instead of the whole thing??
Hi Moeses,
I guess with “the whole thing” you mean the whole json object? To print a random joke in python, I would do something like this:
import urllib2
import json
req = urllib2.Request("http://api.icndb.com/jokes/random")
full_json = urllib2.urlopen(req).read()
full = json.loads(full_json)
print full['value']['joke']
Hope this helps!
that does help a lot. had to change some things around to use for my personal siriServer for my iPhone 4. so now whenever i say chuck norris to siri i get a random quote. Thanks so much again. really cool API.
Cool idea! Is this published somewhere? I can publish it on this website as well, if you want.
How would I store multiple jokes in that python script
It’s not really clear to me what you mean by “storing multiple jokes”, but to fetch multiple, you can just provided the needed number to the API:
http://api.icndb.com/jokes/random/5
In that case, the value in the result will be an array of jokes (see API documentation), so we can print all of them like this:
import urllib2
import json
req = urllib2.Request("http://api.icndb.com/jokes/random/5")
full_json = urllib2.urlopen(req).read()
full = json.loads(full_json)
for joke in full['value']:
print joke['joke']
I found a problem with your API. When a string contains double quotes, the quotes aren’t properly escaped, thereby breaking the JSON data.
Here’s an example I got:
{ “type”: “success”, “value”: { “id”: 394, “joke”: “”Let the Bodies Hit the Floor” was originally written as Chuck Norris’ theme song.”, “categories”: [“chuck norris”] } }
This should be instead:
{ “type”: “success”, “value”: { “id”: 394, “joke”: “\”Let the Bodies Hit the Floor\” was originally written as Chuck Norris’ theme song.”, “categories”: [“chuck norris”] } }
Double quotes are actually HTML encoded (using "), you can check the source of http://api.icndb.com/jokes/394. Have you had issues with this?
It would be good if your API returned the proper mime-type. The servers returns it as text/html, rather than application/json.
Good point, fixed!
This doesn’t seem to be fixed. I just requested http://api.icndb.com/jokes/random and got back JSON content, but the Content-Type header is “text/html”.
Indeed it wasn’t, strange :) Now it should be fixed.
Is it really necessary to HTML-Encode the quotes? Its nasty to decode safely in Javascript without being vulnerable to XSS-Attacks.
Couldn’t you just quote them instead? (ideally you would version the REST API so that clients that depend on the old behavior could still use the old one..).
There are also some question marks where there should be single quotes, e.g. http://api.icndb.com/jokes/141.
Apart from that: good work, keep it up!
Hi ox89,
I added the option ?escape=javascript (also updated the docs above), this will add backslashes to quotes instead of escaping HTML special characters.
The issue with joke 141 was not the result of incorrect escaping, it was in the database like that. Fixed it, I’ll go through the other jokes as well.
Thanks, that was very responsive. In the meantime, I used http://www.strictly-software.com/htmlencode to decode the html entities.
Btw. this is what I have built:
https://github.com/marvinthepa/chuckfluence
No problem, and cool project!
Your XSS remark before interests me. I don’t see how client-side decoding of the HTML encoding makes you vulnerable to XSS, could you elaborate a bit?
Well, lets say someone takes over your database, and changes one of the quotes to
alert(‘you haven been pwned’)
If my plugin would insert this within the page
using
$(‘#id’).html(…)
What would happen? The attacker could execute arbitrary javascript code in the context of my page. This is what I understand as XSS. I might be mistaken though as I don’t know a lot about these topics.
Btw. the attacker wouldn’t even have to take over your database, as you don’t use https we would also be vulnerable to man-in-the-middle-attacks.
whoops, your blog engine stripped the tags out of my post..
the alert needs to be surrounded by script tags:
alert('you have been pwned')
hope this works this time..
It still didn’t work, but I get the picture :) You are correct to be worried about this kind of thing, correct escaping of JSON and HTML indeed is a difficult problem.
What you are describing is an injection attack. Originally, the only way to decode JSON was to use
eval(json)
, in which case JavaScript code in the variablejson
would also be run, leading to JavaScript injection. Now, browsers allow native JSON decoding withJSON.parse()
, making it impossible to sneak in code there.For HTML this is more difficult, browsers do not offer a method for isolating parts of the HTML tree or something similar. So
$(‘#id’).html(...)
could still contain HTML such as a script tag. That’s actually why I escape everything on the server, a joke’sjoke
attribute should never contain HTML tags, making it easier for the client.However, this is still a matter of trust in the web service, its correct functioning, its admin not being malevolent, the security of the web service, the security of the transport etc. Complex problem :)
Hi,
Just wanted t say “Cool idea!” and to point out a small issue, as visible at http://api.icndb.com/jokes/394?escape=javascript&firstName=John&lastName=Doe
Notice the John Doe’ in the response.
By the way, is this name replacing feature related to Chuck Norris sueing Penguin (methinks) for using his name?
Hi Sorin,
Thanks for the bug report. The error is a genitive, “Chuck Norris’ theme song”, which should be “John Doe’s theme song” for names not ending with an s.
And no, this is not a feature against legal issues, it’s just a cool feature. ICNDb is just a database of public jokes, this adds some flavor to it :)
This is part of a larger difficulty of e.g. conjugating correctly when you change the name.
For instance “Real Men”, “Ada Lovelace”, “Chuck Norris” all conjugate differently for common words (they/she/he) and tenses (wants an egg / want an egg).
Hi Admin,
Undoubtedly a very useful API for app developers ;-) Is there a way that I can remove the adult jokes? you know most of the stores are made for 13+ old years, but there is a lot of 18+ material, is there a neat jokes category?
Hi there,
Yes, I set up the category “explicit” for that purpose. As described above, you can fetch a random non-explicit joke using the following URL:
http://api.icndb.com/jokes/random?exclude=%5Bexplicit%5D
Can I combine this with the first and last name like this:
http://api.icndb.com/jokes/random?firstName=John&lastName=Doe;exclude=%5Bexplicit%5D
Hi … I created an API wrapper in C#, so you can easily access this API from C# apps :)
https://github.com/joelmartinez/icndb-csharp
Cool! Added it to the website.
Cool project!
Used this to email all of our product development team before coming to work in the morning to have some laughs :D
Made a PHP client for the API to contribute back.
https://github.com/tistaharahap/chuck-norris-php
Nice, thanks!
Hey, how many jokes have you got so far? It’d be cool to display some stats :D Awesome jokes BTW.
Ah you have,
http://api.icndb.com/jokes/count
. Missed that section :PI made a PHP Wrapper for your API too :P I just didn’t like the other one so here it is: https://github.com/Apathetic012/ICNDb
Howdy Admin,
It looks like your JSON is sometimes invalid:
http://api.icndb.com/jokes/34
http://api.icndb.com/jokes/278
It’s not escaping things properly.
Thanks for the site and the API!
Hi Ian,
What is going wrong precisely? The JSON looks ok to me.
Is the escaping working correctly? I’m not seeing any difference between:
http://api.icndb.com/jokes/141?escape=javascript
http://api.icndb.com/jokes/141?escape=html
Doh, you’re right. Strange that you’re the first to notice this :)
It should be working correctly now (see http://api.icndb.com/jokes/24?escape=html for an example of HTML escaping).
Thanks for the bug report!
Is it just me or callback stopped working?
Fixed!
Wow! That was quick! :D
hi, first of all, thanks for your work!
I’am thinking about integrating random jokes in my web site, as a loader message.
so i’am thinking : if you had a database of jokes in other languages (french for example :)), would it be possible for you to add a language input in the api ?
Hi,
Yes, that should be possible. Do you have French jokes?
I just noticed if you enter a name that does not end with the s there is a problem.
Original: Chuck Norris’ whatever
Problem with: Tom William’ whatever –> missing the s
Hi,
Well noticed. Will fix it when I come around to it.
Nice API and good jokes. I was looking for random posts for my twitter app I designed recently. It pulls random jokes from this API and allows user to post to their twitter account.
Here is the app: http://twitter.jayeshcp.com
I hope you will like it :)
Thanks for sharing this API.
Very cool! I had this idea myself, but didn’t come around to it. A nice addition would be to change the name of Chuck Norris into the name of the Twitter user, which you can do with the API.
Sure, I will add that feature :)
Anyway, I have added your name and site’s link in my app.
Hoping to see more features soon. This is fun !
Thank you.
You sir are awesome.
If you had a raw “curl”-able url as well, that’d be great for message of the day services.
I actually use your api for my mutt email signature!
Thanks.
Hi Erik,
What exactly do you mean by “curl”-able url?
This is pretty awesome :) For business/HR reasons it would be handy to be able to exclude categories (like “explicit”). I currently just loop and reissue if I get one of those.
Thanks :)
By the way, the functionality you talk about already exist, see “Limiting categories”. For your case, use the URL http://api.icndb.com/jokes/random?exclude=%5Bexplicit%5D to leave out explicit jokes.
Hi
just wondering if this api is still in service? i wanna use it in making android app for uni assignment. and also what are the type of categories that you have for the jokes?thanks!
That depends on what you mean with still in service :) It still operates and I’m planning to keep it that way, but I do not plan any updates in the near future.
About the categories: you can list them with http://api.icndb.com/categories
By the way, what is uni assignment?
hi my friend :)
may i use this api in a commercial android app freely? :D
tnx
You may, without cost, but remember: I do not guarantee any up-time or content quality.
I just finished up a Google Glass app. I’ll release it as soon as Google provides a way to distribute Glass apps, and give you a huge shout-out in the description.
Thanks for providing a great API for a great database!
Chuck Me for Google Glass
I am an Android developer and made an application using ‘random’ joke api in Android. Thank you for providing such great database and api.
Here is my link to the application on Google Play Chuck Norris Jokes on Google Play
I also mention your website in app description in Google Play and in credits in application for providing such large database of jokes.
Hi,
This is a great service, I’m making use of it in a mobile application.
However unfortunately the escaped single quotes in the javascript encoded JSON is causing trouble.
Although it seems sensible to javascript encode then i.e. ‘ becomes \’
The JSON standard only specifies a small number of things that can be escaped. You don’t need to encode single quotes.
In desktop browsers they are looser with this standard and it doesn’t cause a problem, however in a mobile environment (not the web browser itself, but e.g. iOS itself)
json.Parse() is stricter and will throw an exception when reaching a \’
Here on the standard page http://www.json.org/ you can see that single quotes are not on the list.
It would be great if you can not encode the single quotes please.
Keep up the good work.
-thanks
Alex.
Hi Alex,
Thanks for the great feedback. I’m currently flooded with work, but will try to fix this as soon as possible. I’m also thinking of putting the code on Github to allow others could contribute as well, so this project can speed up a bit again. I’ll keep you posted :)
That’d be ace – I’d be interested in working on the conjugation.
Nice to hear that! I’ve set up a Github repo: https://github.com/maartendecat/icndb-api You are welcome to add your ideas to the project, I’ll keep on hosting.
Hi, awesome API :-)
I was hoping you could help clarify the way the ?exclude filter works. I see an example in the docs that calls for (what looks like) a JSON encoded array? However, in the comments I see just a string example ?exclude=explicit
Neither of these seem to work all the time for me. I am currently using ?exclude=explicit and I just got one about an erection.
Hi,
It’s both actually, but the recommended usage is using an array (without quotes), e.g.:
http://api.icndb.com/jokes?exclude=[explicit,nerdy]
or
http://api.icndb.com/jokes?exclude=[explicit]
The reason you still got a joke about an erection is that is was not yet labeled explicit. That has been fixed :) See http://api.icndb.com/jokes/229
Is it clear now?
Just wanna point out that in some of the quotes, the lastName parameter isn’t always properly rendered.
http://api.icndb.com/jokes/random?firstName=Jeremy&lastName=Peet
In some cases I got Jeremy Norris, instead of Jeremy Peet.
(am trying to replicate this but I can’t seem to. Maybe it was just a faulty query on my part :D)
Hi,
I checked out the database and there does not seem to be anything wrong with the jokes. I also can’t replicate the problem. If you manage to replicate it again, let me know and I will check it out.
http://api.icndb.com/jokes/random?firstName=John&&lastName=Doe this is the right one.
http://api.icndb.com/jokes/random?firstName=John&“;”lastName=Doe the “;” is wrong
Thanks for the API!
I used it while playing with Angular.js – resulting in this app: http://jsbin.com/kinara
Nice :) Thanks!
Hello there,
Just for fun, I made an Android application and I used your API to pull some random jokes.
Thanks for publishing it for free, greatly appreciated.
Here’s the app url: https://play.google.com/store/apps/details?id=com.gridbug.jokes
Hope you can spread it to others.
Thanks,
Cool, thanks!
Hi,
Just to say thanks for the providing the API and that I’ve knocked up a quick client for the Fantom programming language:
Fantom meets Chuck Norris
Cheers,
Steve.
You’re welcome and thanks to you as well!
Um, that link should have been:
http://www.fantomfactory.org/articles/fantom-meets-chuck-norris
hello! I am currently trying to use this in an automated chat bot, that is pretty limited in what it can output. Is there any way to return a result with just the insult? No category labels or anything, just a random text insult? I had planned on using it for Nightbot on twitch.tv.
Nightbot can return API results, but he displays everything he sees. Any suggestions would be great! Love the API!
Hi,
The API only returns JSON, but it’s easy to get the joke itself from this result. Can you really not parse the result before displaying it?
Thanks for putting this together. I built an application for the pilots of my airline which does some extensive sorting, and I use your API to display a Chuck quote while the progress bar is showing during the sort. The guys really love it! And I love the fact that I can substitute the pilot’s name for Chuck Norris. Can’t wait to see what kind of response that gets :) Also, I’ll be happy to offer my ColdFusion code if you’d like to add it to the library.
Thanks for the service, I just used it at our backend for our admins :)
BEST… API… EVER…
I set this up on my droid with tasker. I open AutoVoice and say “*about chuck norris*” and it grabs something via RESTasker and the tts reads it out loud. Sooo easy. Sooooo awesome. Thank you!
Hi,
How to change lastname? When I make a request with http://api.icndb.com/jokes/random?firstName=John&lastName=Doe it returns jokes with lastname “Norris”
http://api.icndb.com/jokes/random/?firstName=John&lastName=Doe
this should work
http://api.icndb.com/jokes/?firstName=John&lastName=Doe
I can change the name
How to fetch joke from this output
{ “type”: “success”, “value”: { “id”: 167, “joke”: “As a teen, Chuck Norris had sex with every nun in a convent tucked away in the hills of Tuscany. Nine months later the nuns gave birth to the 1972 Miami Dolphins, the only undefeated and untied team in professional football history.”, “categories”: [] } }
My Ruby code is
url = URI.parse(‘http://api.icndb.com/jokes/random’)
req = Net::HTTP::Get.new(url.to_s)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
puts res.body
I tried using puts res.body[‘value’][‘joke’]
We just released the app Funny Chuck based on your API. https://play.google.com/store/apps/details?id=com.tj.chuck
Works lika a charm, thanks and keep up the good work!
Hello,
I have developed an Alfred workflow that uses this API – http://www.packal.org/workflow/norrisisms-chuck-norris-workflow.
Any chance for keyword search in the future? It would be cool to find a list of norrisisms by keyword in case you forget the icndb id.
Thanks for the cool service!
– Justin
I just made a “chucky-fortune” based on your ICNDb.
It gives you a random quote.
PNG endpoint:
http://chuck.cach.in
Text endpoint:
http://chuck.cach.in/text
[…] The documentation for this API is available here. […]
Hi,
FYI, another explicit miss I assume is joke 400, again about dicks.
id: 400,
joke: “Chuck Norris’ dick is so big, it has it’s own dick, and that dick is still bigger than yours.”,
categories: [ ]
Thanks
Good call, updated!
[…] the code is on github. The random jokes come from The Internet Chuck Norris Database. As I said, the jokes were just for fun, this add-in is of course, not a business app. During the […]
Howdy,
I’m working on a small QOTD server in Node, and have it grabbing Jokes from the API as well. I noticed that the categories for many jokes are unpopulated. Is there anything I can do to help categorize the jokes so that people using the API can better filter what they recieve?
Hi,
You can help. I have not gotten around to writing a front-end for managing the categories, but you can help through GitHub by updating the file that contains the jokes:
https://github.com/maartendecat/icndb-api/blob/master/classes/ChuckDatabaseFiller.inc.php
[…] the code is on github. The random jokes come from The Internet Chuck Norris Database. As I said, the jokes were just for fun, this add-in is of course, not a business app. During the […]
[…] Before we begin, it’ll help a little to see how Futures can be useful to us. Futures are a perfect candidate for making concurrent HTTP requests. Let’s start with a simple Ruby application that fetches random Chuck Norris jokes from The Internet Chuck Norris Database: […]
[…] Before we begin, it’ll help a little to see how Futures can be useful to us. Futures are a perfect candidate for making concurrent HTTP requests. Let’s start with a simple Ruby application that fetches random Chuck Norris jokes from The Internet Chuck Norris Database: […]
[…] like Chuck Norris, Polymer is cool – very cool, and so after accidentally coming across the ICNCB service, I thought a simple Web Component which displays some comical facts about Chuck Norris […]
[…] http://www.icndb.com/api/ […]
I could help providing an Portuguese (Brazil) translation of your jokes :)
I often use this API to test API calls in my apps, and have some laughs as I work
Hi,
That would be a cool feature. If you provide the translation, I will code it in the API :)
The jokes are stored in this file: https://github.com/maartendecat/icndb-api/blob/master/classes/ChuckDatabaseFiller.inc.php Could you use the same format, i.e., with the %firstname% and %lastname%?
Por favor!
[…] the Internet Chuck Norris Database. It provides access to a database of Chuck Norris jokes via a simple API, and seemed as good as anything. I figured if I made it seem like these were things someone […]
Thank you for Help. I like your services.
I want to contribute too.
That’s nice to hear :) I haven’t really updated the API in some years, so any help and ideas are welcome.
How you can contribute: https://github.com/maartendecat/icndb-api -> fork and pull requests, I can deploy on the master server.
What you can contribute: do you have something in mind yourself? Some stuff that I had in mind: adding all the jokes proposed in the comments of this blog to the collection, extending the DSL for the name inclusion (so that abbreviations and genitives etc work correctly), developing a front-end to submit jokes and maybe vote on them, etc.
Hi
What a great job dude!!!
There has been several calls in the thread to implement keyword search. This would be another awesome feature.
And thank you for your marvelous job!!!
[…] it’s not yours. Is this one […]
Hi,
I’ve built an app using this. I am new to Android development this helped.
You can check it here:
http://nothingmuch.in/ChuckNorrisJokes.apk
I’ve already credited/cited you. I’ll put an about screen link and put a visible link very soon(1-week :). This is v1.0
Thanks for your tremendous work.
Sam
Hi there. Late to this party, but I’m trying to build a random quote generator (as part of Free Code Camp’s course) using the Name Change function, and it won’t return the changed last name. I get “John Norris” instead of John Doe…help? Thank you!
Sorry – just found the answer in previous comment! Thanks and keep up the great work. Will link to my quote generator when it’s done.
Hello,
I have developed Android app using your API. It is free of course and you can see and download the code here:
https://github.com/ignacioavila/ChuckReligion
I hope you like it.
Thanks,
Ignacio Avila.
Cool, thanks!
Hi,
Great work here. Just learning to code and used your API for a small project: http://jwaynedavidson.com/projects/chuck-norris/jokes.html
I would like to move to https on my site but unfortunately due to same-origin policy I am unable to call your http API from my https site. Have you thought about moving to https? StartSSL (https://startssl.com/) offers a free Class 1 SSL Certificate so it would be a no cost solution.
Best,
Josh
Finally got around to fixing this, here you go: https://api.icndb.com/jokes/random
Thanks for implementing! Looks like quite a few are using https from the comments below. :)
Hey!
I love the database. It was a big hit with friends. I used it on my website as an example of how to implement an API. I host my website out of my home so recently I switched over to HTTPS and since then the page I wrote broke because the API call is over HTTP instead of HTTPS. Can you look into securing the API server?
Thanks
Finally got around to fixing this, here you go: https://api.icndb.com/jokes/random
Thank you so much. I greatly appreciate it. Things are working great now. Keep up the good work!
[…] tem as suas nuances, por exemplo, para obter os fatos sobre o Chuck Norris eu utilizei uma API na ICNDB (Internet Chuck Norris Database – sim, isso existe =)). Ou seja, quando você chama a Alexa e […]
[…] Go! […]
Awesome API!
I have used it to make this: https://codepen.io/petersvedman/pen/zqQRyo. as a part of the FreeCodeCamp curriculum. Thank you for providing this service.
I’ve been using your API for years (thanks, btw), but now my requests all get 403 errors. They work in a browser, but not in code. Did something change?
Hi Ken,
The only recent change is that I added HTTPS to the API last week, but the original clients should all still work.
I just tried $.get(“http://api.icndb.com/jokes/random?firstName=John&lastName=Doe”) using jQuery from another website and that works correctly (both HTTP and HTTPS).
What client do you use and which URL do you call?
Ken, I think I solved the issue. Can you let me know if it works again at your side?
Yes, it’s working now. Before you fixed it (thanks!), my work-around was to add a “User-Agent” header to the request, whose value could be anything (??). I’m glad I don’t have to do that any more.
Btw, if you’re interested, my Groovy command-line demo is part of https://github.com/kousen/IntroGroovy and my Android app (called the Internet Carlos Ray Database) is freely available at https://play.google.com/store/apps/details?id=com.kousenit.icrdb (the code is also on Github under the ICNDB project).
Good to hear, thanks for the ping back. And thanks for your cool contributions!
Hi,
I am also getting 403 errors using either mechanize or urllib2 with python 2.7 .py file
br = mechanize.Browser()
url = br.open(‘https://api.icndb.com/jokes/random’)
mechanize._response.httperror_seek_wrapper: HTTP Error 403: request disallowed by robots.txt
Works OK if I put the URL in a browser.
Thanks , Nic
Ok, thanks for the bug report. I think I solved the issue, can you retry and let me know?
That is working now in python – thanks for such a quick fix
I loved your API so much, that I built it into a training class I wrote a section of the training where students create a custom activity in a workflow that pulls a random joke with a person’s name inserted. It was a fun activity that could be used to say something fun about a technician who resolves a high priority incident. Unfortunately, we now get “The owner of this website (api.icndb.com) has banned your access based on your browser’s signature.”
Is there any chance of getting the ban removed? We shouldn’t be hitting it too much in the course at any given time (the exception being last week when we had our annual user conference and had 120 people taking the class at once). Any chance you could email me and work something out?
Thanks,
Ben
Hi Ben,
Do you still get this error today? Multiple people reported about similar issues this week, which were solved on Thursday. If you still get the error, could you send me a piece of code that triggers it?
Regards,
Maarten
PS: I have no problem whatsoever with you using the API for any number of students, I hope you have fun with it!
Awesome! Thanks so much, Maarten. I will let you know if we see the error again. Much appreciated!
Is there a better way to provide you with the full contents of the error than posting it here if/when we see it again, or do you just prefer to have it posted in the forum?
Thanks,
Ben
We are also facing this issue while running this api on our AWS EC2 instances. It fails with SSL error there. But it works on local machine well. I tried another Rest client on my local, and trying Jersey client it threw error on my local machine as well. Here is the error html thats returned:
\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n
Please enable cookies.
\n
\n
\n
\n Error\n 1010\n Ray ID: 2abc76a856372fff • 2016-05-31 18:24:34 UTC\n
\n
Access denied
\n
\n\n
\n\n
\n
\n
\n
What happened?
\n
The owner of this website (api.chucknorris.io) has banned your access based on your browser’s signature (2abc76a856372fff-ua21).
\n
\n\n \n
\n
\n\n
\n
\n CloudFlare Ray ID: 2abc76a856372fff\n •\n Your IP: 122.172.95.22\n •\n Performance & security by CloudFlare\n \n
\n
\n\n\n
\n
\n\n \n\n\n\n
I lowered the security settings of the API, do you still have the error now?
You can post it here, no problem :) so is the issue resolved for you?
Fetch a joke:
curl -s -X GET http://api.icndb.com/jokes/random?escape=javascript | sed ‘s/\\\\\//\//g’ | sed ‘s/[{}]//g’ | awk -v k=”joke” ‘{n=split($0,a,”,”); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w joke| cut -d":" -f2| sed -e 's/^ *//g' -e 's/ *$//g'
Hi admin,
First of all thanks for this.
I was just wondering if its possible to do a paginate query to your api. For example i need to pull 10 records for page1, page2 to pull from 11 to 20 and so on.
From the api documentation above, I dont see a way to achieve this.
Something like:
http://api.icndb.com/jokes/?context=greater&jokeId=20&limit=10
Hi Mutinda,
If it’s not in the API description, I haven’t gotten around to it :) If you want, you can add it to the API yourself and send me a pull request on GitHub. On the other hand, I don’t think you currently need this feature because fetching all jokes does not take too long. In other words, you can just fetch all jokes and implement pagination locally in your website/app/…
http://api.icndb.com/jokes/random/ Using this as API for Nightbot exchange an { “type”: “success”, “value”: { “id”: 37, “joke”: ” Joke Here “, “categories”: [] } }
I want to remove { “type”: “success”, “value”: { “id”: 37, “joke”: ” and “, “categories”: []}} from quote, i want the pure joke like
This its the joke.
Any possible way for it?
http://api.icndb.com/jokes appears to be down (522 error)
Probably a temporary issue at my provider, seems to be fixed now.
Love it, using it on with a bot on a irc network.
Try this in an OS X terminal:
curl -s http://api.icndb.com/jokes/random?exclude=%5Bexplicit%5D | python -c ‘import json,sys;obj=json.load(sys.stdin);print obj[“value”][“joke”]’ | say
hahah
I’m having an issue , while loading with the json.loads. I did retrieved the webpage data , but i don’t think that the format of the json file is correct , since there is an error for the loads and the stuff < can you please provide correct ..
Hey dude, I love this api, the only thing when I tried to change the main character, the Norris part wouldn’t change, even in your example is failing, I solved this on https://github.com/Capuno/Cowsay-with-chuck-api with the replace in-built method.
Which URL did you try? http://api.icndb.com/jokes/random?firstName=John&lastName=Doe seems to work fine for me.
http://api.icndb.com/jokes/random?firstName=John&lastName=Doe
The one on the docs above seems outdated
Wrong paste, this one doesn’t work: http://api.icndb.com/jokes/random?firstName=John&lastName=Doe
That’s the one on the docs
Lol you have some weird script on this comments sections mate
api.icndb.com /jokes/random? firstName=John& lastName=Doe
I feel so stupid adding another comment but maybe the html is not allowing some parts of the url to show, and I can’t edit my first comment so here goes an image of the url that is not working: http://i.imgur.com/got8joi.png
and proof that is not working: http://i.imgur.com/YUFTlpM.png
Again, I feel so stupid posting images of urls…
The URL is incorrect. See the “&” in the URL, this should be just “&”. This is the result of copy-pasting a “&” into the address bar, in which case the text is URL-encoded and “&” is replaced.
[…] have a small java based app that makes requests to the Internet Chuck Norris Database to retrieve chuck norris famous jokes. It accepts an integer number on the […]
[…] muy nerd cool; crearon “The Internet Chuck Norris Database” que provee una sencilla api para obtener bromas del famoso y […]
Hi admin,
I am using your db for my school project and also is that okay if i use your chucknorris pic and word.
Thanks
Hi admin,
“http://api.icndb.com/jokes/random?firstName=John&lastName=Doe” looks like it’s broken for the last name :/ the result looks like
{ “type”: “success”, “value”: { “id”: 279, “joke”: “John Norris does, in fact, live in a round house.”, “categories”: [] } }
[…] Go! […]
hi i wanted to use your api to develope a quote machine on jquery,but i need to know how to add the ssl as its a secure http
hey. love the api, thanks. I wrote a blog surrounding it a while back (http://srlawr.blogspot.co.uk/2016/02/the-way-of-lightning-component.html) and now I’ve been asked to present a workshop in London (Feb 10th 2016) implementing the example in said blog. So I am SO GLAD you have the include/exclude parameters now.
Can I take it excluding the “explicit” category will make this API suitable for a mixed, diverse and probably generally uncool audience?
I can’t find a summary/listing of the categories, so I just visually scanned the full JSON. I kinda need to remove anything overtly sexist, sexual or “racist”… I will still include a warning at the start of the workshop though I think :D
I’m keen to give you full credit through the workshop too – other than this website – if you have any other credentials (a name, photo?) you would like on a credit slide, please e-mail it over!
[…] are probably the most entertaining way to get JSON. For this example, we will use the Chuck Norris Quote API. Calls to the http://api.icndb.com/jokes/random API endpoint return JSON that looks like […]
w http://canadapharm24h.review where the best canadian pharmacy
[…] Go! […]
Hello, I used your Chuck Norris RestAPI to create a random joke generator. You can see it here http://codepen.io/heccas/full/PpNeKX/
Thanks for creating this simple API.
Best regards.
Hi admin,
This is a great site for Chuck Norris jokes. I am using your API in my Android app, look for ‘Joke Norris’ in Google Play.
Thanks!
This is a great project. Thanks for sharing.
http://codepen.io/djfordz/full/bVrGQB/
Good site: http://tadalph24.com ;; http://sildph24.com
@Admin Thank you so much for this API.. Really helped me with understanding the usage of API and HTTP requests.
There is a small bug though:
When I use this request:
http://api.icndb.com/jokes/random?firstName=Ben&lastName=parker
Response: “Ben Norris doesn’t stub his toes. He accidentally destroys chairs, bedframes, and sidewalks.”
The last name does not seem to get replaced. Can you please fix this bug?
Please add cors headers to option and get :)
Chrome calls:
XMLHttpRequest cannot load http://api.icndb.com/jokes/random/. Request header field X-Requested-With is not allowed by Access-Control-Allow-Headers in preflight response.
Hi guys, I’m from Argentina.
Please update SSL certificates,
net::ERR_SSL_VERSION_OR_CIPHER_MISMATCH
This is my spoken Chuck facts.
https://jape.com.ar/chuck.html#
God spoke: “Let there be light. ” Chuck Norris said:” Sure thing.” and invented fire.
God commanded Noah to build an Ark because Chuck Norris had informed Him he was taking a shower.
The earth was without form and void, and darkness was over the face of the deep. And the Spirit of God was hovering over the face of the waters.
The day before Chuck Norris had flushed the toilet.
Dog was created when Chuck Norris ordered a wolf to fetch.
[…] Go! […]
What are the copyright rules for using your dataset?
Hey there!
Joke ID’s: 246, 287, 374 are uncategorized and they probably should be added to explicit! Cool api!
Hello blogger, i must say you have very interesting articles here.
Your blog should go viral. You need initial traffic boost only.
How to get it? Search for: Mertiso’s tips go viral
Does Chuck Norris use this API, or does he just brute force his way into the database?
FYI, only the first name parameter seems to be read. If you use the example above for John Doe, the result is a joke about John Norris. If you switch the parameters so lastName is declared first, then the result is a joke about Chuck Doe.
graphql api endpoint for getting a random joke.
https://api.graph.cool/simple/v1/cjb62g9rn0pdv01331wcffmva
query { getRandomJoke { joke } }
I have to say that, this is wonderful api for beginners. Thanks you all!
i know this has not had anything said on it i a while but is there a way to get it to stop showing { “type”: “success”, “value”: { “id”: 305, “joke”: “Chuck Norris knows everything there is to know – Except for the definition of mercy.”, “categories”: [] } } and only show “Chuck Norris knows everything there is to know – Except for the definition of mercy.” for example. i like to use this with nightbot for livestreams on youtube and twitch
Hello admin,
Using this as API I creating a simple AngularJS app.
According to the project’s technical task I need to retrieve a few jokes under one category.For example, http://api.icndb.com/jokes/random?limitTo=%5Bnerdy%5D/6
or
http://api.icndb.com/jokes/random?limitTo=%5Bnerdy%5D/9
but unfortunately it doesn’t work.
MAYBE I DID SOMETHING WRONG?
I’m trying your API through Repl.it. I keep getting this error:
‘Not allowed to request resource’
Thank you, this is very nice.
I wrote a Mastodon bot at https://botsin.space/@chucknorrisfacts
[…] any Web services, get information and display it. For example, I have used a Joke Service from http://www.icndb.com/api/ to display a random Chuck Norris jokes on every […]
[…] Chuck Norris Database […]