
檢查投票狀態
驗證使用者是否可以為您的伺服器投票
端點
GET
/v1/votes/server/:serverToken/:ipAddress參數
serverTokenstringYour server's unique identifier
ipAddressstringThe user's IP address (e.g., 192.168.1.1)
回應範例
Can Vote
{
"can_vote": true,
"seconds_until_next_vote": 0
}Cannot Vote Yet
{
"can_vote": false,
"seconds_until_next_vote": 86400
}程式碼範例
async function checkVoteStatus(serverToken, userIp) {
const url = `https://api.server-hytale.com/v1/votes/server/${serverToken}/${userIp}`;
const res = await fetch(url);
const { can_vote, seconds_until_next_vote } = await res.json();
if (can_vote) {
console.log('User can vote now!');
} else {
console.log(`User can vote in ${seconds_until_next_vote}s`);
}
}需要幫助?
加入我們的Discord社群,以獲得將我們的API整合到您的應用程式中的幫助。