API Documentation

Vote API

The Vote API allows you to verify if a user voted for your server

<?php
$server_token = "Your server token"; // Replace "TOKEN" with your server token.
$user_ip = isset($_SERVER["HTTP_CF_CONNECTING_IP"])
    ? htmlentities($_SERVER["HTTP_CF_CONNECTING_IP"])
    : htmlentities($_SERVER["REMOTE_ADDR"]); // User IP address
$json = file_get_contents("https://private-server.net/en/api/v1/servers/$server_token/votes/$user_ip");
$json_data = json_decode($json);
if ($json_data->success) {
    echo 'You have voted successfully';
    // You can use the following variables:
    $datas = $json_data->data; // This variable will contain the JSON data returned by the API.
    $datas->username; // User username
    $datas->voted_at; // Corresponds to the voting date in timestamp format
    $datas->is_connected; // Corresponds to the user's connection status
    $datas->is_subscriber; // Corresponds to the user's subscription status
    $datas->next_vote_seconds; // Corresponds to the remaining seconds before the user can vote again
} else {
    echo 'Not voted or already voted';
}
?>

If "success" = true

{
    "success":true,
    "data":{
        "username":"Trevor",
        "voted_at":1689241974,
        "next_vote_seconds":5395,
        "is_connected":true,
        "is_subscriber":false
    }
}

If "success" = false

{
    "success":false,
    "message":"Message..."
}

Statistics API

Statistics API to retrieve your server data (position, clicks, votes, comments, and the rating)

<?php
$server_token = "Your server token"; // Replace "TOKEN" with your server token.
$json = file_get_contents("https://private-server.net/en/api/v1/servers/$server_token/statistics");
$json_data = json_decode($json);
if ($json_data->success) {
    echo 'Server found';
    // You can use the following variables:
    $datas = $json_data->data; // This variable will contain the JSON data returned by the API.
    $datas->position; // Corresponds to the server's position in the monthly ranking
    $datas->votes_count; // Corresponds to the server's vote count
    $datas->clicks_count; // Corresponds to the server's click count
    $datas->comments_count; // Corresponds to the server's comment count
    $datas->rating; // Corresponds to the server rating out of 5
} else {
    echo 'The specified Token is incorrect';
}
?>

If "success" = true

{
    "success":true,
    "data":{
        "position":12,
        "votes_count":1202,
        "clicks_count":287,
        "comments_count":7,
        "rating":5
    }
}

If "success" = false

{
    "success":false,
    "message":"Message..."
}

Donors API

API to retrieve users who donated to your server from the donation page

<?php
$server_token = "Your server token"; // Replace "TOKEN" with your server token.
$json = file_get_contents("https://private-server.net/en/api/v1/servers/$server_token/donors");
$json_data = json_decode($json);
if ($json_data->success) {
    echo 'Server found';
    // You can use the following variables:
    $datas = $json_data->data; // This variable will contain the JSON data returned by the API.
    foreach($datas as $data) {
        $data->username; // User username
        $data->avatar; // Corresponds to the donor or subscriber's avatar
        $data->amount; // Corresponds to the donation amount
        $data->message; // Corresponds to the donor's message
        $data->currency; // Corresponds to the donation currency
        $data->created_at; // Corresponds to the donation date in timestamp format
    }
} else {
    echo 'The specified Token is incorrect';
}
?>

If "success" = true

{
    "success":true,
    "data":[{
        "username":"Trevor",
        "avatar":"url",
        "amount":10,
        "message":"If "success" = true",
        "currency":"eur",
        "created_at":1689241974
    }]
}

If "success" = false

{
    "success":false,
    "message":"Message..."
}

Subscribers API

API to retrieve users who subscribed to your server from the vote page

<?php
$server_token = "Your server token"; // Replace "TOKEN" with your server token.
$json = file_get_contents("https://private-server.net/en/api/v1/servers/$server_token/subscribers");
$json_data = json_decode($json);
if ($json_data->success) {
    echo 'Server found';
    // You can use the following variables:
    $datas = $json_data->data; // This variable will contain the JSON data returned by the API.
    foreach($datas as $data) {
        $data->username; // User username
        $data->avatar; // Corresponds to the donor or subscriber's avatar
        $data->started_at; // Corresponds to the subscription start date in timestamp format
        $data->ended_at; // Corresponds to the subscription end date in timestamp format
    }
} else {
    echo 'The specified Token is incorrect';
}
?>

If "success" = true

{
    "success":true,
    "data":[{
        "username":"Trevor",
        "avatar":"url",
        "started_at":1689241974,
        "ended_at":1689241974
    }]
}

If "success" = false

{
    "success":false,
    "message":"Message..."
}

Voters API

API to retrieve users who voted for your server from the vote page

<?php
$server_token = "Your server token"; // Replace "TOKEN" with your server token.
$json = file_get_contents("https://private-server.net/en/api/v1/servers/$server_token/voters");
$json_data = json_decode($json);
if ($json_data->success) {
    echo 'Server found';
    // You can use the following variables:
    $datas = $json_data->data; // This variable will contain the JSON data returned by the API.
    foreach($datas as $data) {
        $data->username; // User username
        $data->position; // Corresponds to the server's position in the monthly ranking
        $data->votes; // Corresponds to the number of votes
        $data->avatar; // Corresponds to the donor or subscriber's avatar
        $data->subscribed; // Corresponds to the subscription status
        $data->public_profile; // Corresponds to the public profile url
    }
} else {
    echo 'The specified Token is incorrect';
}
?>

If "success" = true

{
    "success":true,
    "data":[{
        "username":"Trevor",
        "position":1,
        "votes":10,
        "avatar":"url",
        "subscribed":true,
        "public_profile":"url",
    }]
}

If "success" = false

{
    "success":false,
    "message":"Message..."
}