DEV Community 👩‍💻👨‍💻

Cover image for Hindi Jokes API : GET random hindi jokes
Jon Snow
Jon Snow

Posted on • Updated on

Hindi Jokes API : GET random hindi jokes

Free forever

I created a REST API using node Js , express and MongoDB. It uses the Hindi Jokes API to fetch random jokes in Hindi language. The app is deployed on Render.

API Link

  https://hindi-jokes-api.onrender.com
Enter fullscreen mode Exit fullscreen mode

Custom Endpoints

Random joke

Endpoint: /jokes

Example: https://hindi-jokes-api.onrender.com/jokes?api_key=YourApiKey

Response:

{
    "_id": "631c381d798f9e2887b4cba1",
    "status": "Success",
    "jokeContent": "आओ 2 Min मौन रखे उन लड़कियों के लिए.. जिनकी शक्ल Nokia 1100 जैसी है और घमंड Iphone14 जैसा…. 😆🤣😋😉",
    "jokeNo": 116,
    "created_by": "Amit Sharma"
}
Enter fullscreen mode Exit fullscreen mode

Specify count (MAX 50)

In order to get multiple jokes in a single request specify the count with the following endpoint.

Endpoint: /jokes/{count}

Example: https://hindi-jokes-api.onrender.com/jokes/2?api_key=YourApiKey

Response:

{
"status": "Success",
"created_by": "Amit Sharma",
"totalJokes": "2",
"data": [
   {
      "_id": "63199fb5f02231a5ee2965a5",
      "jokeContent": "शादी के दो दिन बाद दूल्हा उस ब्यूटी पार्लर में गया जहां से उसकी बीवी ने शादी के लिए मेकअप करवाया था उसने पार्लर वाली मैडम को आईफोन 7 गिफ्ट किया और थैंक्यू बोलकर चला                         आया मैडम ने खुशी खुशी आईफोन का डब्बा खोला तो उसमें नोकिया 1100 पड़ा था साथ में एक पर्ची भी थी जिस पर लिखा था मुझे भी ऐसा ही महसूस हुआ था😆🤣😋😉 ",
       "jokeNo": 71
   },
  {
       "_id": "63217239def3f928de48b025",
       "jokeContent": "थप्पड मारने पर नाराज वाईफ से हसबंड बोला:  ...आदमी उसी को मारता है जिससे वो प्यार करता है.   ..वाईफ ने हसबंड को 2 थप्पड मारे और बोली  ...आप क्या समझते है मै                          आपसे प्यार नही करती ... 😆🤣😋😉",
       "jokeNo": 141
   }
 ]
}
Enter fullscreen mode Exit fullscreen mode

GITHUB URL

for more updates check GitHub repository of API

https://github.com/amitSharma7741/Hindi_jokes_api
Enter fullscreen mode Exit fullscreen mode

How to use

You can use this API in your projects. Just make a GET request to the API endpoint and you will get a random joke in Hindi language. You can also use the API in your browser by visiting the API endpoint in your browser.

Using Fetch

const fetchData = async () => {
    const url = "https://hindi-jokes-api.onrender.com/jokes?api_key=YourApiKey"
    const response = await fetch(url);
    const data = await response.json();
    console.log(data)
}
Enter fullscreen mode Exit fullscreen mode

Using axios

// First you need to intall axios
npm i axios

// use axios 

const sendGetRequest = async () => {
    const url = "https://hindi-jokes-api.onrender.com/jokes?api_key=YourApiKey"
    try {
        const resp = await axios.get(url);
        console.log(resp.data);
    } catch (err) {
        // Handle Error Here
        console.error(err);
    }
};

Enter fullscreen mode Exit fullscreen mode

If you getting any issue with api feel free to do a comment or write your issue on github repo

Top comments (0)

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.