Showing posts with the label fetch

Random jokes generator using API (Free)

           Today let's see how to create a random joke generator which will basically fetch the data from a free API. My main target is to show how to use API and put the data in HTML using javaScript.      Today we will use JokeApi website -  . You can read the documentation from here. We will send an fetch request to -,sexist&type=single&idRange=0-319  . You can get this type of URL from JokeApi and any free API. You can replicate the same process for other APIs as well.      When we send request to this URL of the API, it will send back a response which is transformed into JSON format in JavaScript. Let's have a look on the sample JSON data -  { "error": false, "category": "Pun", "type": "single", "joke": "I bought some shoes from a drug dealer. I don't know what he laced them with, but I was trippi