User Predictions
This document provides an overview of information on the implementation of match prediction by users.
Basic information
Each user can predict on a match from a round that has not yet taken place. Predictions begins after the end of the last match of the previous round but no earlier than 7 days before the start of the first match. During this period, users can cast, change, or delete their predictions. 15 minutes before the start of the first match, prediction for that round closes, and casting, changing, or deleting predictions is no longer possible. Predictions for the next round begins at the end of the last match of the current round.
Endpoints
Warning
Only logged in users can predict.
List of user answers
GET /api/v3/match_predictors/user_answers
User answer
GET /api/v3/match_predictors/user_answers/{user_answer_id}
Create user answer
POST /api/v3/match_predictors/user_answers
Update user answer
PATCH /api/v3/match_predictors/user_answers/{user_answer_id}
Delete user answer
DELETE /api/v3/match_predictors/user_answers/{user_answer_id}
The request and response for each of the endpoints, which can be found in the API documentation: https://umpirepublicapi.docs.apiary.io
Answer Types
A user can submit the following types of predictions HOME, AWAY, DRAW
Under The Hood
When a user casts a prediction for a specific match, the number of predictions is counted within a transaction. When retrieving the Match resource, you can include 'match_predictor_match_prediction' in the response to receive predictions count information as shown below:
{
"id": "306",
"type": "match_predictor_match_prediction",
"attributes": {
"away": 1324,
"draw": 56,
"home": 83492
}
}