After the teams have played and the game server has the results, a request must be made to the OkLetsPlay back-end as follows. The game should implement proper retry mechanisms.
In this scenario, the game should expect to send only a single result containing all participants' and teams' scores. The endpoint is idempotent to allow for retries, however only the first accepted result will be deemed valid.
curl \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${XXX-secret-jwt}' \
-d '{
"match_id": "600f36a861246f889d381029",
"participants": [
{
"id": "user_id_1",
"score": 300
},
{
"id": "user_id_2",
"score": 100
}
],
"teams": [
{
"id": "team_id_1",
"score": 300,
"ranking": 1
},
{
"id": "team_id_2",
"score": 100,
"ranking": 2
}
]
}' \
${config.okletsplay_url}/api/game/v1/finish
match_id
stringThe unique id for this match.participants
arrayList of participants in the match.id
platform-idThe platform id of the player.score
uint8_tThe player's individual score in the match.teams
arrayList of teams in the match.id
team-idThe unique id for the team.score
uint8_tThe team's combined score in the match.ranking
uint8_tThe team's resulting rank.forfeit?
booleanTrue if the team has forfeited the match. (optional)In this scenario, the game should expect to send one result per player containing only that participant's scores. The endpoint is idempotent to allow for retries, however only the first accepted result for each player will be deemed valid.
curl \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${XXX-secret-jwt}' \
-d '{
"match_id": "600f36a861246f889d381029",
"participants": [
{
"id": "user_id_1",
"score": 300
}
]
}' \
${config.okletsplay_url}/api/game/v1/finish
curl \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${XXX-secret-jwt}' \
-d '{
"match_id": "600f36a861246f889d381029",
"participants": [
{
"id": "user_id_2",
"score": 100
}
]
}' \
${config.okletsplay_url}/api/game/v1/finish
match_id
stringThe unique id for this match.participants
arrayList of participants in the match.id
platform-idThe platform id of the player.score
uint8_tThe player's individual score in the match.Each game is free to apply its own rules to decide when a player should be forfeit; if the forfeit occurs on the OkLetsPlay platform then we'll notify the game through the webhook, if using the push flow, or it'll be reflected in the active matches query, if using the poll flow. If the game determines a player has forfeit the game, then this information should be included in the results as follows.
curl \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${XXX-secret-jwt}' \
-d '{
"match_id": "600f36a861246f889d381029",
"participants": [
{
"id": "user_id_1",
"score": 300
},
{
"id": "user_id_2",
"score": 100
}
],
"teams": [
{
"id": "team_id_1",
"score": 300,
"ranking": 1
},
{
"id": "team_id_2",
"score": 100,
"forfeit?": true
}
]
}' \
${config.okletsplay_url}/api/game/v1/finish
match_id
stringThe unique id for this match.participants
arrayList of participants in the match.id
platform-idThe platform id of the player.score
uint8_tThe player's individual score in the match.teams
arrayList of teams in the match.id
team-idThe unique id for the team.score
uint8_tThe team's combined score in the match.ranking
uint8_tThe team's resulting rank.forfeit?
booleanTrue if the team has forfeited the match. (optional)A game should only be considered aborted if the game's back-end determines it has made an error. If a player crashes, disconnects, or otherwise stops competing, that player has forfeit and the other player should be considered the winner. Aborted and tied games incur no match fees for the users.
curl \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${XXX-secret-jwt}' \
-d '{
"match-id": "600f36a861246f889d381029",
"error": {
"reason": "Something went wrong!"
}
}' \
${config.okletsplay_url}/api/game/v1/finish
match_id
stringThe unique id for this match.error
objectAn object containing the error metadata.reason
stringCustom error message.