πŸŽ‰πŸ•ΊπŸŽΈπŸΊπŸŒ³πŸ› οΈ

Dadnauseam API Documentation

Generate endless dad jokes with Groq's lightning-fast inference technology!

πŸš§πŸ› οΈπŸ”§πŸ€‘ Dad Joke Construction Zone πŸ€‘πŸ”§πŸ› οΈπŸš§

Generate Dad Joke

Endpoint: /dad_joke

Method: POST

Content-Type: application/json

Request Body:

{
  "dad_joke_topic": "pizza"
}
        

Example Response:

{
  "joke": "Why did the pizza maker go to jail? Because he kneaded the dough!"
}
        

Example Usage

Node.js

const fetch = require('node-fetch');

async function getDadJoke(topic) {
  const response = await fetch('http://your-api-url.com/dad_joke', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ dad_joke_topic: topic }),
  });

  const reader = response.body.getReader();
  const decoder = new TextDecoder();
  let joke = '';

  while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    joke += decoder.decode(value);
  }

  console.log(joke);
}

getDadJoke('pizza');
        

Python

import requests

def get_dad_joke(topic):
    url = 'http://your-api-url.com/dad_joke'
    headers = {'Content-Type': 'application/json'}
    data = {'dad_joke_topic': topic}
    response = requests.post(url, headers=headers, json=data, stream=True)

    joke = ''
    for chunk in response.iter_content(chunk_size=None):
        joke += chunk.decode('utf-8')

    print(joke)

get_dad_joke('pizza')
        

Vanilla JavaScript

async function getDadJoke(topic) {
  const response = await fetch('http://your-api-url.com/dad_joke', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ dad_joke_topic: topic }),
  });

  const reader = response.body.getReader();
  const decoder = new TextDecoder();
  let joke = '';

  while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    joke += decoder.decode(value);
  }

  console.log(joke);
}

getDadJoke('pizza');
        

cURL

curl -X POST http://your-api-url.com/dad_joke \
     -H "Content-Type: application/json" \
     -d '{"dad_joke_topic": "pizza"}'