icanhazdadjoke is an online website that provides a free API to get random joke of the day as well. Here this is a very simple API that you can use to get random joke and use it wherever you want. You can make the API calls from the command line or use a web browser. And the best part is that here you don’t need an API token to get the joke. You just make an API request, it will simply return a joke. You can easily implement this API in any of you web or mobile development projects.
API’s can greatly reduce the coding part used in mobile applications and website development. There are a lot of services that provide their API for weather, IP location, and some other. But if you want an API for random joke for your websites or any app then you can use this website. Here it lets you fetch random joke as text, JSON and as an image. You can embed the joke image in your website using the image tag directly and do what you want.
Free API to Get Random Joke of the Day:
icanhazdadjoke is a very simple API that you can use to get a random joke of the day. There is nothing specific to install on your PC. However, you may need cURL if you are on Windows. After that, just start with using the API. You can use terminal or command prompt to issues GET request and it will return the joke. As there are multiple methods to get the joke, so you will have to use the methods according to what output you want.
If you want to get a random joke in JSON format then you use this syntax to make API call. It will return the joke in JSON format.
curl -H "Accept: application/json" https://icanhazdadjoke.com/
If you want to get the random joke in text format then you make calls like this
curl -H "Accept: text/plain" https://icanhazdadjoke.com/
When you want to get a random joke and save it as an image, make call like this. This will save the image in the current folder. The image that it saves has transparent background.
curl https://icanhazdadjoke.com/j/<Joke_ID>.png --output abc.png
If you want to get a specific joke then use this format to make API call. To get a specific joke, you will need its ID that you can copy from the website. This is useful if you want to embed a specific joke on your website.
These are the different methods that you can use to get random joke of the day. Also, you can see the full API documentation here to see the some advanced usage. You can use this API as long as you want. The best part is that there is no API key or token required so technically there is no limit. But that doesn’t mean you should start abusing this API by making too many frequent calls.
icanhazdadjoke is a very nice and a simple website that you can use to get a random joke for the day. Since, there is no API key or token required so you can use it any way you want. Also, the syntax of the API call is very simple and you can easily use this API in your web and mobile application projects. So, if you are looking for a free random joke API then you may give this a try.