Introduction

Welcome to the API documentation for the Random Joke Generator. This API provides you with a collection of computer, programming, and development-related jokes in JSON format. It is designed to add a touch of humor to your applications, websites, or projects. This documentation will guide you through the usage, examples, and contribution guidelines of the API.

Usage

To retrieve a random joke, make a GET request to the API endpoint with the help of fetch or Ajax of JavaScript. The response from the server will contain a JSON object with the joke data, including the setup and punchline.

You can retrieve the Jokes in JavaScript by Using the Fetch. Code Sample is Given Below:

                    
       fetch("http://randomjokesapi.santosh0.com.np/JokesAPI/")
       .then(response=>response.json())
       .then(response=>{
           console.log(response);
       }).catch(e=>{
           console.log(e);
       })
                        
                    

You can retrieve the Jokes in JavaScript by Using the Ajax. Code Sample is Given Below:

                    
        let xhr = new XMLHttpRequest();
        xhr.open('GET', 'http://randomjokesapi.santosh0.com.np/JokesAPI/');
        xhr.onreadystatechange = function() {
        if (xhr.readyState === 4 && xhr.status === 200) {
            let data = JSON.parse(xhr.responseText);
            console.log(data);
            }
        };
        xhr.send();
                
                

Example

Result:

Loading

Contribution

Contributions to the Random Joke Generator API are welcome. If you have any jokes related to computer science, programming, or development, feel free to contribute them to the API. Get the GitHub Repository from below to contribute in the API. Your contributions will help make the API even more entertaining and enjoyable for the developer community.

GitHub Repository https://github.com/santoshvandari/Random-Jokes-API

Thank you for choosing the Random Joke Generator API. We hope it brings a smile to your face and adds a dash of fun to your coding adventures!

www.000webhost.com