# ID

## Blague par ID

<mark style="color:blue;">`GET`</mark> `https://api.night-api.com/jokes/:id`

#### Path Parameters

| Name                                 | Type   | Description                                  |
| ------------------------------------ | ------ | -------------------------------------------- |
| id<mark style="color:red;">\*</mark> | number | ID de la blague à récupérer (Entre 1 et 900) |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| authorization<mark style="color:red;">\*</mark> | String | Your API key |

{% tabs %}
{% tab title="200 Blague trouver" %}

```javascript
{
    "status": 200,
    "content": {
        "id": 44,
        "type": "global",
        "blague": "Que dit un canard quand il va aux toilettes ?",
        "reponse": "Je vais au petit coin."
    }
}
```

{% endtab %}

{% tab title="400: Bad Request ID incorrect" %}

```javascript
{ 
    status: 400, 
    error: "Bad ID provided", 
}
```

{% endtab %}
{% endtabs %}

```javascript
const axios = require("axios");

axios.get('https://api.night-api.com/jokes/44', {
    headers: {
        authorization: "API token"
    }
})
.then(function (response) {
    console.log(response.data);
})
```

\
Or with the NPM module

```javascript
const { NightAPI } = require('night-api');
const api = new NightAPI('YOUR_API_KEY');

const blague = await api.jokes.byID(50); // Return: Promise
```
