| map | The map UID to show the votes on it | `OkNwgzSwDLZSWSRPsUKY7EA1Cg5`
Example response:
```json
{
{
"mapId": "currentMapUId",
"mapUid":"OkNwgzSwDLZSWSRPsUKY7EA1Cg5",
"userId": "UserLogin",
"votes":53,
"name": "mapname for example: Summer 2021 - 01"
"average":85,
"lastVoteDate":"2021-08-23T00:28:16.273Z"
}
}
```
```
Info: I heard that the name is not really relevant, because the API of trackmania.io already provides information about a map. Nevertheless, in the current implementation this field should at least not be null.
**POST /setVote**<br>
**GET /getPlayerVote**<br>
Writes the vote of a player to the respective map into the database table.
Returns the current voting status of a player for the current map.<br>
| map | The map UID to show the votes on it | `OkNwgzSwDLZSWSRPsUKY7EA1Cg5`
| player | The player login that he voted on it | `Jtmn3kBnSSadky_mLNhp_A`
Example response:
```json
{
{
"mapId": "currentMapUId",
"mapUid":"OkNwgzSwDLZSWSRPsUKY7EA1Cg5",
"userId": "UserLogin",
"playerLogin":"Jtmn3kBnSSadky_mLNhp_A",
"name": "mapname for example: Summer 2021 - 01",
"vote":50,
"vote": 40
"date":"2021-08-23 04:55:49.105"
}
}
```
```
**POST RESPONSE**<br>
The response is the same in both cases:
**GET /mostVotedMaps**<br>
```
Returns the top most voted maps. in decreasing order (from the most voted map to the least voted map)<br>
There's no parameters for this request!
Example response:
```json
{
{
"votes": 3,
"OkNwgzSwDLZSWSRPsUKY7EA1Cg5":65,
"average": 63,
"7fsfRSUCQ7YwfBEdRk_GivW6qzj":56,
"vote": 80
"KOylxZkny8RdOEFhchN1kG6Uoo1":32,
"n8KeykdPYEsJM6RPEZcQHVRVRIb":32,
"RfGQDoOnJ0FiswOBjpL3V7nkF0a":32,
"Iwo4gO_0dQ3FVQ1xeYjho5ZmLrf":1,
}
}
```
```
If other players only listen to the current voting status on the map, the vote for the respective client is not returned, since this is client-specific and therefore not interesting for everyone. So for them the response will be like:
```
**POST /setVote**<br>
Writes the vote of a player to the respective map into the database table.<br/>
⚠ You need an Authorization header with a valid token in order to do requests for this. After getting your token, set your Authorization value to `Basic yourtokenhere`
@@ -82,4 +115,4 @@ The following star scale was defined for the voting plugin:
...
@@ -82,4 +115,4 @@ The following star scale was defined for the voting plugin:
## Attention
## Attention
My backend is really not secure for SQL-Injection and some other secure stuff. If some more people want to use it, I should protect it more.. but that take some time. You are welcome to help me with this. That would be a nice thing if we can introduce a global map vote functionality in a secure and highly available way. :)
My backend is 100% not secure for SQL-Injection and some other secure stuff. If some more people want to use it, I should protect it more.. but that take some time. You are welcome to help me with this. That would be a nice thing if we can introduce a global map vote functionality in a secure and highly available way. :)