API Documentation
Voting API
Allows you to verify if a user has voted for your server in the last 90 minutes
Endpoint | https://private-server.net/en/api/v1/servers/{server_token}/votes/{user_ip} |
{server_token} | Indicate the Token associated with your server. You can find it in the 'Settings' tab |
{user_ip} | Specify the IP address to check. You can specify an IPV4 or IPV6 address |
Code Example
<?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's IP address
$json = file_get_contents("https://serveur-prive.net/api/v1/servers/$server_token/votes/$user_ip");
$json_data = json_decode($json);
if ($json_data->success) {
echo 'You have successfully voted';
// You can use the following variables:
$datas = $json_data->data; // This variable will contain the JSON data returned by the API.
$datas->username; // User's 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 number of seconds remaining before the user can vote again
} else {
echo 'No or already voted';
}
?>
Response Example
{
"success": true,
"data": {
"username": "Trevor",
"voted_at": 1689241974,
"next_vote_seconds": 5395,
"is_connected": true,
"is_subscriber": false
}
}
Statistics API
Allows you to retrieve data about your server such as its position, number of votes, etc.
Endpoint | https://private-server.net/en/api/v1/servers/{server_token}/statistics |
{server_token} | Indicate the Token associated with your server. You can find it in the 'Settings' tab |
Code Example
<?php
$server_token = "Your server token"; // Replace "TOKEN" with your server token.
$json = file_get_contents("https://serveur-prive.net/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 number of votes for the server
$datas->clicks_count; // Corresponds to the number of clicks on the server
$datas->comments_count; // Corresponds to the number of comments on the server
$datas->rating; // Corresponds to the server's rating out of 5
} else {
echo 'The specified Token is incorrect';
}
?>
Response Example
{
"success": true,
"data": {
"position": 12,
"votes_count": 1202,
"clicks_count": 287,
"comments_count": 7,
"rating": 5
}
}
Donors API
Allows you to retrieve users who have donated to your server from the donation page
Endpoint | https://private-server.net/en/api/v1/servers/{server_token}/donors |
{server_token} | Indicate the Token associated with your server. You can find it in the 'Settings' tab |
Code Example
<?php
$server_token = "Your server token"; // Replace "TOKEN" with your server token.
$json = file_get_contents("https://serveur-prive.net/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; // Donor's username
$data->avatar; // Corresponds to the donor's or subscriber's avatar
$data->amount; // Corresponds to the amount donated
$data->message; // Corresponds to the donor's message
$data->currency; // Corresponds to the currency of the donation
$data->created_at; // Corresponds to the date of the donation in timestamp format
}
} else {
echo 'The specified Token is incorrect';
}
?>
Response Example
{
"success": true,
"data": [{
"username": "Trevor",
"avatar": "url",
"amount": 10,
"message": "Message...",
"currency": "eur",
"created_at": 1689241974
}]
}
Subscribers API
API to retrieve users who have subscribed to your server from the voting page
Endpoint | https://private-server.net/en/api/v1/servers/{server_token}/subscribers |
{server_token} | Indicate the Token associated with your server. You can find it in the 'Settings' tab |
Code Example
<?php
$server_token = "Your server token"; // Replace "TOKEN" with your server token.
$json = file_get_contents("https://serveur-prive.net/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; // Subscriber's username
$data->avatar; // Corresponds to the subscriber's avatar
$data->started_at; // Corresponds to the start date of the subscription in timestamp format
$data->ended_at; // Corresponds to the end date of the subscription in timestamp format
}
} else {
echo 'The specified Token is incorrect';
}
?>
Response Example
{
"success": true,
"data": [{
"username": "Trevor",
"avatar": "url",
"started_at": 1689241974,
"ended_at": 1689241974
}]
}
Top Voters API
Allows you to retrieve the list of users who have voted for your server over the month
Endpoint | https://private-server.net/en/api/v1/servers/{server_token}/voters |
{server_token} | Indicate the Token associated with your server. You can find it in the 'Settings' tab |
Code Example
<?php
$server_token = "Your server token"; // Replace "TOKEN" with your server token.
$json = file_get_contents("https://serveur-prive.net/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; // Voter's username
$data->position; // Corresponds to the server's position in the monthly ranking
$data->votes; // Corresponds to the number of votes the player has
$data->avatar; // Corresponds to the voter's avatar
$data->subscribed; // Corresponds to the voter's subscription status
$data->public_profile; // Corresponds to the URL of the voter's public profile
}
} else {
echo 'The specified Token is incorrect';
}
?>
Response Example
{
"success": true,
"data": [{
"username": "Trevor",
"position": 1,
"votes": 10,
"avatar": "url",
"subscribed": true,
"public_profile": "url",
}]
}