No-Api-Key
Search…
πŸ“ƒ
Examples
Examples for no-api-key.com

No-Api-Key routes are all Get Requests

1
// Example using axios & async/await:
2
​
3
const axios = require('axios');
4
​
5
(async () => {
6
const url = 'https://no-api-key.com/api/v2/animals/dog';
7
try {
8
const { data } = await axios.get(url);
9
console.log(data);
10
} catch (e) {
11
return console.log(e);
12
}
13
})();
14
​
15
// Example with plain ole fetch:
16
​
17
(async () => {
18
const url = 'https://no-api-key.com/api/v2/animals/dog'
19
try {
20
const response = await fetch(url);
21
const data = await response.json();
22
console.log(data);
23
} catch (e) {
24
return console.log(e);
25
}
26
})();
Copied!

Example for discord.js

trash route : https://api.no-api-key.com/api/v1/trash
1
const { MessageEmbed } = require('discord.js')
2
​
3
module.exports = {
4
name: "trump",
5
category: "extra",
6
run: async (client, message, args) => {
7
const url = 'https://api.no-api-key.com/api/v2/trump?message=';
8
const text = args.join(' ');
9
const encoded = url + encodeURIComponent(text);
10
console.log(url, encoded);
11
​
12
try {
13
const embed = new MessageEmbed()
14
.setImage(encoded);
15
await message.channel.send(embed);
16
} catch (e) {
17
console.log(e);
18
}
19
​
20
}
21
}
22
Copied!
Have suggestions? Join discord link on home page, or email me. Click on the routes, to see required paramters. Thanks for using!
​
Last modified 2mo ago