The Pomomon Club Leaderboard Standard provides a unified interface for a play-time leaderboard that should track the time spent in the focus phase of Pomomon Farm. This leaderboard should give players more motivation to study and give them a way to compete against other players or measure how much time they spent studying in a certain period of time.
This specification describes how to add submissions, authenticate with the leaderboard or even just query it normally.
When a request to an endpoint fails, the HTTP status code will be an error code as well. The body will contain a human-readable message that you may not show to users, but log in the console to potentially help you fix an error or help the server provider fix issues on their side.
All the endpoints listed below in the specification only specify their request when a body should be set (so only POST requests) and any other parameters are in the URL. The description of all endpoints will state what is needed or not based on the output you desire. For how to call authorized endpoints, refer to the section below.
To call an authorized endpoint, you only have to specify the Authorization header with the session token returned from the endpoints below.
Authorization: Bearer %SESSION_TOKEN%
Sessions in the Pomomon Club API let you add submissions to your account and also see your own spot in the leaderboard with an endpoint that dynamically changes pages based on your current position.
Each session has a token that lets you call authorized endpoints. How authorization works is covered in the Authorization section below. All endpoints that require a session token have authorized in their title below.
However, to protect against cheating a few restrictions apply.
PUT /api/sessions
GET /api/sessions?token=%AUTHENTICATION_SESSION_TOKEN%
This endpoint creates a new authentication session and returns a token for it. This is not the final token you can use to call authorized endpoints. Read the Authentication flow section above to see what this endpoint is good for.
Response:
{
"token": "some_token",
"auth_url": "https://api.pomomon.club/some/example"
}
This endpoint checks if a authentication session has been successfully completed. If completed, it will also return the session token you can use to call authorized endpoints. Additionally, the error flag specifies if the user encountered any kind of error during their authentication. When the error flag is true, your may want to show an error popup and let the user complete the auth again.
Response:
{
"verified": true,
"error": false,
"session_token": "some_token"
}
The start endpoint should be called only when starting a focus-phase. The duration of the focus-phase can be provided in minutes and or seconds. When the focus-phase ends, the end endpoint has to be called to complete the phase and submit the score to the leaderboard. The end endpoint should be called directly after the phase ends. If the start endpoint gets called before the previous phase has ended, the old submission gets overwritten.
The request registers the focus-phase with the provided duration starting when the request reaches the server. In this example the duration is 720 seconds. Both parameters have to be set, only one can have a value of 0.
Minutes:
Seconds:
Request:
{
"minutes": 10,
"seconds": 120
}
Response: 200 SUCCESS
This verifies the session end and submits the score to the leaderboard.
Response: 200 SUCCESS
This endpoint creates a server-sent event stream, that sends the client the current leaderboard selection and all updates if the leaderboard changes. The page parameter returns the the given leaderboard page. When the client is authenticated the self parameter can be used instead, it selects the leaderboard page the player is on. When no parameter is provided page 0 is selected as the default. A leaderboard page contains 15 entries or less if it’s the last page and not enough entries are left.
Page:
Self:
Response sent through the SSE stream:
{
"page": 2,
"scores": [
{
"id": "some user id",
"name": "a cool username",
"score": 1020000
},
{
"id": "some user id",
"name": "c00l p3rs0n",
"score": 480000
},
...
],
"max_page": 12
}