Welcome to PlayMC.LK!
Discover the ranking of the best Sri Lankan Minecraft servers.

How to use our API?

Check if the player has voted (by username/ip)

To know if a player has voted, simply use the URL below, replacing:

  • {serverId} with your server ID.
  • {ip,Username} with the player's IPv6 or username.

Your server's ID is at the end of your vote link URL. (Ex: https://www.playmc.lk/server-theserver.1)

https://www.playmc.lk/api/checkVote/{serverId}/{ip,Username}

PHP usage example:

In this example, we retrieve the returned result in the $resultat variable. To read the result (in JSON), we convert it into an array. Then you just need to test if the "success" value is true!

If the player has voted, you can retrieve the value: prochainVote (timestamp) as in the example below to display the remaining time before they can vote again.


$resultat = file_get_contents("https://www.playmc.lk/api/checkVote/1/Notch");
$jsonDecoded = json_decode($resultat, true);

if ($jsonDecoded['success'] === true) {
    echo "The player has voted successfully";


// Optional: Remaining time to vote.

$dateProchainVote = new DateTime();
$dateProchainVote->setTimestamp($jsonDecoded['prochainVote']);
$ecart = $dateProchainVote->diff(new DateTime());
echo '<p>The player can vote in: ';
echo $ecart->h.' hour(s) ';
echo $ecart->i.' minute(s) ';
echo $ecart->s.' second(s) ';
echo '</p>';


}else{
    echo "The player has not voted";
}
Retrieve top voters

To retrieve the list of top voters and their votes, simply use the URL below, replacing:

  • {serverId} with your server ID.
  • {limit} with the maximum number of players (max 30)

Your server's ID is at the end of your vote link URL. (Ex: https://www.playmc.lk/server-theserver.1)

https://www.playmc.lk/api/topVotes/{serverId}/{limit}

PHP usage example:

In this example, we retrieve the returned result in the $resultat variable. To read the result (in JSON), we convert it into an array. Then you just need to list the players and their votes!


	  $resultat = file_get_contents("https://www.playmc.lk/api/topVotes/1/30");
$jsonDecoded = json_decode($resultat, true);

foreach($jsonDecoded["classement"] as $joueur){

   echo '<p>' . $joueur["pseudo"] . " - " . $joueur["votes"] . " votes </p>";

}