UNPKG

24fire-full-api

Version:
118 lines (93 loc) 2.64 kB
# The Full 24Fire API for NodeJS. ### First you need your Server API Key: ![image](https://github.com/KenleyundLeon/24fire-API/assets/92249212/c3aa2e93-c6c5-4783-a425-cab027a1dca4) ### Then you can use it like this: Example ```js const { config, status, start, stop, restart} = require('24fire-full-api'); (async() => { const Data = await config('YOUR_SERVER_API_KEY'); console.log(Data); })(); ``` it should return: ```json { "status": "success", "requestID": "9a220700-00c4-42f7-bc8c-9487f09ec72c", "message": "VM config retrieved successfully", "data": { "hostsystem": { "datacenter": { "name": "SkyLink Data Center BV", "country": "Niederlande", "city": "Eygelshoven" }, "name": "nl_xeon", "node": "XEON 04", "processor": "Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz", "memory": "DDR3 Synchronous Registered (Buffered) 1600 MHz", "nvme_hard_drives": "Samsung SSD PM9A1" }, "config": { "cores": 5, "mem": 41984, "disk": 70, "os": { "name": "debian_11", "displayname": "Debian 11" }, "username": "root", "password": "xxxxxxxxxx", "hostname": "KVM", "network_speed": 2000, "backup_slots": 2, "ipv4": [ { "ip_address": "88.151.xxx.xxx", "ip_gateway": "88.151.xxx.xxx", "ddos_protection": "arbor", "rdns": "24fire.de" } ], "ipv6": [ { "ip_address": "2a12:8641:xxxx:xxxx::", "ip_gateway": "2a12:8641:xxxx::xxxx", "requires_restart": false } ] } } } ``` ### If you need 1 Value you can do it like this: ```js const { config, status, start, stop, restart} = require('24fire-full-api'); (async() => { const Data = await config('YOUR_SERVER_API_KEY'); console.log(Data.data.config.cores); })(); ``` This will return the Cores Your Server has! ```json 10 ``` ### To start, stop or restart your server you just need to use the wrapper like this: ```js const { config, status, start, stop, restart} = require('24fire-full-api'); (async() => { const Data = await start('YOUR_SERVER_API_KEY'); console.log(Data); })(); ``` The Console Log is Optional it will return: ```json { "status": "success", "requestID": "6220a191-fe11-4d56-a67d-2686b5020505", "message": "VM power command sent", "data": [] } ``` ### If you have any Errors or Questions. Just ask me via dc: m_kenley or open an Issue report on github!