API Documentation

Making Requests

Handling Errors

When an error occurs we will return a status code of 4xx/5xx and return a JSON object with an error

{
    "error": "LuaShield > all???"
}

All of our error messages are user friendly

Quick Example

We didn't have to set our content type in this example as we aren't sending any data

const fetch = require("node-fetch");
const LUASHIELD_API_KEY = "";

async function GetAccountInformation() {
    return new Promise(async (resolve, reject) => {
        let Response = await fetch("https://api.luashield.com/account", {
            method: "GET",
            headers: { 
                ["LuaShield-API-Key"]: LUASHIELD_API_KEY
            }
        })
        .then(res => res.json())
        .catch(er => reject(er.toString()))

        if (Response?.error) {
            reject(Response.error);
        }

        resolve(Response);
    });
}

(async () => {
    let AccountInformation = await GetAccountInformation()
    .catch(er => console.log(er)); 

    console.log(AccountInformation)
})();

Last updated