diff --git a/wiki/api/index.html b/wiki/api/index.html index 55b21cf..f5a48c2 100644 --- a/wiki/api/index.html +++ b/wiki/api/index.html @@ -147,6 +147,7 @@
Retrieve the status and connection details for your server. Type can be 'Minecraft', 'Bedrock', or 'SFTP'.
+var unirest = require('unirest');
+
+ const type = 'Minecraft'; // Can be 'Minecraft', 'Bedrock', or 'SFTP';
+
+ unirest
+ .get(`https://api.my-mc.link/status/${type}`)
+ .headers({
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'x-my-mc-auth': 'TokenHere'
+ })
+ .then((response) => {
+ if (response.body.success) {
+ console.log('Connection Details:', response.body.connection);
+ console.log('Status:', response.body.status);
+ } else {
+ console.error('Error:', response.body.message);
+ }
+ })
+ .catch((err) => {
+ console.error('Request Failed:', err.message);
+ });
+
+ Response:
+{
+ success: true,
+ connection: {
+ hostname: 'my-mc.link',
+ port: '37505',
+ connect: 'my-mc.link:37505'
+ },
+ status: {
+ isOnline: true,
+ data: {
+ version: { name: {}, protocol: 770 },
+ players: { max: 5, online: 0, sample: [] },
+ motd: {
+ raw: 'My Test Server',
+ clean: 'My Test Server',
+ html: 'My Test Server'
+ },
+ favicon: null,
+ srv_record: null,
+ mods: null
+ }
+ }
+ }
+