All pages
Powered by GitBook
1 of 1

Loading...

Category

Choose which Category of joke you would like to have

Joke by Category

GET https://api.night-api.com/jokes/:type

Path Parameters

Name
Type
Description

Headers

Name
Type
Description

Lists of available categories:

  • global

  • dev

  • dark

  • limit

Or with the NPM module

beauf

  • blondes

  • type*

    string

    Type of jokes to get (global, beauf, dev, limit, dark)

    authorization*

    String

    Your API key

    {
        "status": 200,
        "content": {
            "id": 44,
            "type": "global",
            "blague": "Que dit un canard quand il va aux toilettes ?",
            "reponse": "Je vais au petit coin."
        }
    }
    {
        "status": 400,
        "error": "Bad type provided"
    }
    const axios = require("axios");
    
    axios.get('https://api.night-api.com/jokes/global', {
        headers: {
            authorization: "API token"
        }
    })
    .then(function (response) {
        console.log(response.data);
    })
    const { NightAPI } = require('night-api');
    const api = new NightAPI('YOUR_API_KEY');
    
    const blague = await api.jokes.byCategory('dev'); // Return: Promise