API documentation
English
The player votes on our platform, then goes to your website to trigger the call to our API and receive their reward. Our API responds with a JSON array.
Verification by IP addressIPv4 and IPv6SecuredJSON response
Voting URL
Link to place on your website
Your player's voting link must contain the ID of your game server:
https://beta.top-metin2.org/in/{id}-{name}/
- {id} ID of your game server, for example
42 - {name} server name in the address of its page, for example
my-server
API
Vote verification
GEThttps://beta.top-metin2.org/api/verify/{key}/{ip}/
- {key} secret key of your game server (Your server’s “API” page)
- {ip} IP address of your player
Settings
| Field | Type | Description |
|---|---|---|
| key | string | Secret key to your game server |
| ip | string | IP address of your player |
Responses
| Status | Header | Response | Data | Timestamp |
|---|---|---|---|---|
| true | 200 | Player has voted - Verified vote | Date and time of the vote in datetime format (UTC+0) | Object |
| false | 101 | IP address is invalid | NULL | NULL |
| false | 102 | IP address or ASN is not safe | NULL | NULL |
| false | 103 | API Key does not exist | NULL | NULL |
| false | 104 | Wrong API Called | NULL | NULL |
| false | 105 | Game server banned | NULL | NULL |
| false | 106 | Game server disabled | NULL | NULL |
| false | 107 | Vote has already been verified by our API | Date and time of the vote in datetime format (UTC+0) | Object |
| false | 108 | Player vote does not exist | NULL | NULL |
Our API has two main statuses:
- Bool (true) ⇒ The vote has been verified, you can reward your player
- Bool (false) ⇒ An error occurred while checking the vote
If your player voted, you can reward him, otherwise the response variable contains the possible error message. Our API contains other variables that allow you to target anomalies and the reasons why our API is declining a request.
Example
HTTP/1.1 200 OK
{
"status" => true,
"header" => 200,
"response" => "Player has voted - Verified vote",
"data" => "31-12-9999 23:59:59",
"timestamp" => {
"next_vote" => 1711204824,
"current_vote" => 1711199424,
"delay_vote" => 2504
}
}
PHP example
Adapt it with your reward
You need to install our API script on one of your pages on your website. It must be installed on a secure area, that is to say, a page where your player must be connected to your website to consult and access said page. Our API allows you to reward your player for having voted for your game server within our platform, for this you must adapt and add the script of your reward.
<?php
$key = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
// Secret key of your game server
$ip = isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER['REMOTE_ADDR'];
// Get your player's IP address
$api = "https://beta.top-metin2.org/api/verify/{$key}/{$ip}/";
// Route
$response = @file_get_contents($api);
// API Call
$vote = json_decode($response);
// Response decoding
if ($vote->status){
// Vote OK
// You can donate virtual currencies
} else {
// [OR] The vote has already been verified
// [OR] No votes were found
// [OR] An error has occurred
}
?>