βœ‰
Request
A few examples in of how you could use the api.

Python example:

# imports
import aiohttp
import asyncio
​
# your api token
kawaii_token = "token"
​
# request
async def kawaii(main, sub, filter):
async with aiohttp.ClientSession() as session:
async with session.get(f'https://kawaii.red/api/{main}/{sub}/token={kawaii_token}&filter={filter}/') as r:
js = await r.json()
return str(js["response"])
​
# print async environment (normally standard in bot environment)
async def main():
print(await kawaii("gif", "kiss", []))
​
# create async environment
loop = asyncio.get_event_loop()
loop.run_until_complete(main())

JavaScript example:

const { Kawaii } = require("kawaii-api");
​
const api = new Kawaii("token");
​
api.get("gif", "kiss").then((result) => {
console.log(result);
});
​
api.endpoints("gif").then((result) => {
console.log(result);
});
​
// or async/await
​
const get = async() => {
const result = await api.get("gif", "kiss");
console.log(result);
}
​
const endpoints = async() => {
const result = await api.endpoints("gif");
console.log(result);
}

C# example:

//Our Handle Request gets Created.
using System;
using System.Net.Http;
using System.Net.Http.Json;
using KawaiiAPI_Request_Example;
​
//Make the request and make the actually call.
using (var client = new HttpClient())
{
try
{
//Our kawaii API token which we get on https://kawaii.red/dashboard/
var kawaii_API_token = "";
//Get the Json result from the website
var response = await client.GetFromJsonAsync<KawaiiRedApi>(
string.Format("https://kawaii.red/api/gif/{0}/token={1}&filter={2}/", "kiss",
kawaii_API_token, new int[] { })
);
​
//check if the response is not null
if (response is not null)
{
//print our final image into the Console.
Console.WriteLine(quot;Image is | {response.Response}");
}
}
catch (Exception e)
{
//Catches an Exception and print it into the console.
Console.WriteLine(e);
throw;
}
}

Output:

"https://api.kawaii.red/gif/kiss/kiss1.gif"
Last modified 1mo ago
Copy link
On this page
Python example:
JavaScript example:
C# example: