This is a general purpose guide, depending on your language
and/or platform this will be different. The only requirements
are that your language/platform can send HTTPS requests
and receive them.
The API information can be enumerated via the following URL:
https://internetcatdatabase.com/metadata.json
It is reccomended to use that URL for everything from
base URLs to image counts, since it is an important
part of the API's functionality.
Then, from there, you can select a random number
and make a request to the website to retrieve
an image, which all are currently only available
in the WEBP format.
The JSON file is easy to read by intention, so
that way writing the client code is easy and simple.
Here is a simple example of using the API in modern Javascript:
(async function() {
let dataJSON = await (await fetch("https://internetcatdatabase.com/metadata.json")).json();
let ext = dataJSON.info.ext;
let data = dataJSON.cats.main;
let url = `${data.root}${data.endpoint}${Math.floor(Math.random() * data.count) + 1}${data.info.ext}`;
console.log(url); // Example output: https://cdn.internetcatdatabase.com/123.webp
})();