EXAMPLES

All responses are returned in JSON format

Python Examples
JavaScript Examples
Luau Examples

PYTHON

Synchronous (with requests)

Make sure to install the required dependencies:

pip install requests
import requests
headers = {
    'Authorization': 'Bearer your api key'
}
r = requests.get('https://api.rac-corp.net/v0/utilities/ping', headers=headers)
print(r.status_code)
print(r.json())
                

Asynchronous (with aiohttp)

Make sure to install the required dependencies:

pip install aiohttp
import aiohttp
import asyncio

headers = {
    'Authorization': 'Bearer your api key'
}

async def main():
    async with aiohttp.ClientSession() as session:
        async with session.get('https://api.rac-corp.net/v0/utilities/ping', headers=headers) as resp:
            if resp.status != 200:
                return f'Status: {resp.status}'
            
            return await resp.json()

print(asyncio.run(main()))
                

JAVASCRIPT

Synchronous

fetch(
    'https://api.rac-corp.net/v0/utilities/ping', {
        method: 'GET',
        headers: {'Authorization': 'Bearer your api key'}
    }
)
.then(response => {
    if (!response.ok) {
        throw new Error(`Status: ${response.status}`)
    }
    return response.json()
})
.then(data => {
    console.log(data)
})
.catch(error => {
    console.log(`error: ${error}`)
})
                

Asynchronous

(async () => {
    try {
        const resp = await fetch('https://api.rac-corp.net/v0/utilities/ping', {
            method: 'GET',
            headers: {'Authorization': 'Bearer your key'}
        })
        let data = await resp.json()
        console.log(data)
    } catch (e) {
        console.log(e)
    }
})()

LUAU (ROBLOX)

Make sure you've turned on Allow HTTP Requests under Game Settings => Security

local HTTPService = game:GetService('HttpService')
local result = HTTPService:RequestAsync({
    Url = 'https://api.rac-corp.net/v0/utilities/ping',
    Method = 'GET',
    Headers = {
        Authorization = 'Bearer your api key'
    }
})
print(result.Status)
print(result.Body)