Add new API Endpoint
This commit is contained in:
@ -147,6 +147,7 @@
|
||||
<li><a href="#get-my-hash">GET /my-hash</a></li>
|
||||
<li><a href="#get-my-geyser-hash">GET /my-geyser-hash</a></li>
|
||||
<li><a href="#get-my-sftp-hash">GET /my-sftp-hash</a></li>
|
||||
<li><a href="#get-status-type">GET /status/{type}</a></li>
|
||||
<li><a href="#get-list-players">GET /list-players</a></li>
|
||||
<li><a href="#get-website">GET /website</a></li>
|
||||
<li><a href="#get-map">GET /map</a></li>
|
||||
@ -480,6 +481,64 @@ unirest
|
||||
}</code></pre>
|
||||
</div>
|
||||
|
||||
<!-- GET /status/{type} -->
|
||||
<div class="feature-card tilt-card">
|
||||
<h3 id="get-status-type" class="text-xl minecraft-font mb-3 text-teal-400">GET /status/{type}</h3>
|
||||
<p class="text-sm opacity-90 leading-relaxed mb-4">Retrieve the status and connection details for your server. Type can be 'Minecraft', 'Bedrock', or 'SFTP'.</p>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>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);
|
||||
});</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
<p class="text-sm opacity-90 leading-relaxed mt-4"><strong>Response:</strong></p>
|
||||
<pre class="language-json"><code>{
|
||||
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: '<span><span>My Test Server</span></span>'
|
||||
},
|
||||
favicon: null,
|
||||
srv_record: null,
|
||||
mods: null
|
||||
}
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<!-- GET /list-players -->
|
||||
<div class="feature-card tilt-card">
|
||||
<h3 id="get-list-players" class="text-xl minecraft-font mb-3 text-teal-400">GET /list-players</h3>
|
||||
@ -848,8 +907,6 @@ unirest
|
||||
]
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="explore-more" class="section-bg p-8 sm:p-10 text-center mb-12">
|
||||
<h2 class="text-3xl minecraft-font mb-6 bg-clip-text text-transparent bg-gradient-to-r from-teal-400 to-blue-500">
|
||||
|
Reference in New Issue
Block a user