API for vote reward


Published on 2018-04-18




With our API you have the possibility to check if a player has voted for your server and reward him in game. 

For this, you must use a plugin compatible with Trackyserver. 


You will find the KEY and the ID of your server in the edit page. 



 Step by step explanations


1) The player types the command /vote on the server to display the voting link to Trackyserver.com.


2) The player goes to the voting page and click on "Steam vote" where he will have to identify himself via steam. 

Once the vote is done, the player's steamid is saved in our database.


3) The player types the command /claim or /checkvote on the server, the plugin sends a request to the Trackyserver API to check if he has voted during the last 24 hours and if he has not already received his reward.


4) The player is rewarded.



 Claim vote request for developers


To claim the vote and reward player, you can query our API with a GET http web request: 

API responseDefinition
0API key is incorrect or steamid was not found in our database.
Player has not voted in the past 24 hours.
1Player’s steamid was found in our database. Player has voted in the last 24 hours ! 
You can reward the player in the game (the vote is now CLAIM)
2The player has voted in the last 24 hours but has already claimed his reward.
Do not reward him anymore !


 Check vote request for developers


This query URL does not CLAIM, it is useful only to check if a player has voted for your server during the last 24 hours. 
For example, when the player connects to the server and if he did not vote, you can send a message inviting him to do so.


API responseDefinition
0API key is incorrect or steamid was not found in our database.
Player has not voted in the past 24 hours.
1Player has voted but has not yet claimed his reward
2Player voted and claimed his reward


 Example with the EasyVote plugin for Rust

 Download EasyVote


Go to oxide and download and install the plugin on your Rust server.
Check the Rust servers and make sure your server is not already registered, otherwise add it.

Add these lines in "VoteSitesAPI" in your EasyVote.json config file 

Also specify the ID and KEY of your server in "Servers". 


 Example with the Votifier plugin for Unturned

 Download Votifier

Add your server to our Unturned servers and install the EasyVote plugin.

Add the following line in the Votifier.configuration.xml file by adding the api KEY.  

<Service name="trackyserver.com" apikey="" />

Add the following lines in <ServiceDefinitions>

<ServiceDefinition name="trackyserver.com">
  <CheckHasVoted>http://www.api.trackyserver.com/vote/?action=claim&key={0}&steamid={1}</CheckHasVoted>
  <ReportSuccess>http://www.api.trackyserver.com/vote/?action=status&key={0}&steamid={1}</ReportSuccess>
</ServiceDefinition>
Type /reward in game to receive your reward, the player must first have the reward permission.

 Example with the FiveM script

 Download FiveM vote script 

Set the trackyServerId and trackyServerKey variables in the server.lua file to your server ID and server KEY like example below. Convar is useful if you have multiple FiveM servers.

local trackyServerId = "87921"
local trackyServerKey = "62d4103cf638c550e20b928a3067f4a6"
Commands:

/vote (To display the server's voting link)
/checkvote (Type this command after voting for the server to receive your reward)