Statistics
Stats
The Statistics module manages statistics for applications and players. It provides endpoints to retrieve application statistics, update or create player statistics, and fetch player statistics within a specified date range.
info
Base Endpoint: /api/v1/stats
Available Endpoints
1. Get Statistics Configured for Application
- Method & Path:
GET /api/v1/:applicationId/stats
- Description: Retrieves statistics configured for a specific application
- URL Parameters:
applicationId
— Required. The unique identifier of the application.
- Headers:
Authorization
— Required for authenticated access
- Response Body: An array of statistics, each containing:
id
: Unique identifier for the statistic.name
: Name of the statdescription
: Short description of the statdefaultValue
: Default value of the stat if any
cURL Command
curl --request GET \
--url https://api.yarsaplay.com/api/v1/__APPLICATIONID__/stats
Response Body
[
{
"defaultValue": "<number>",
"description": "<string,null>",
"id": "<uuid>",
"name": "<string>"
},
{
"defaultValue": "<number>",
"description": "<string,null>",
"id": "<uuid>",
"name": "<string>"
}
]
2. Create or Update Logged In Gamer Statistics
- Method & Path:
POST /
- Description: Updates existing statistics or creates new statistics for the logged-in gamer.
- Headers:
Authorization
: Required for authenticated access.
- Request Body:
statsId
(required): The unique identifier for the statistic.value
(required): The value for the statistic to change by.
- Response Body:
id
: Unique identifier for the statistic.value
: The updated value of the statistic.total
: Sum of the stat valuehighest
: Highest sat value
cURL Command
curl --request POST \
--url https://api.yarsaplay.com/api/v1/stats \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--header 'Content-Type: application/json'
#Response Body
{
"id": "<uuid>",
"value": {
"highest": "<number>",
"total": "<number>"
}
}
3. Get Logged In Gamer Statistics
- Method & Path:
GET /
- Description: Retrieves statistics for the logged-in gamer, optionally filtered by a date range.
- Headers:
Authorization
: Required for authenticated access.
- Query Parameters:
from
(optional): The start date for filtering statistics. Must be a valid date string represented in ISO 8601 format.to
(optional): The end date for filtering statistics. Must be a valid date string represented in ISO 8601 format.
- Response Body: An array of statistics, each containing:
id
: Unique identifier for the statistic.value
: The value of the statistic containingtotal
: Sum of the stat valuehighest
: Highest sat value
cURL Command
curl --request GET \
--url https://api.yarsaplay.com/api/v1/stats \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
[
{
"id": "<uuid>",
"value": {
"highest": "<number>",
"total": "<number>"
}
},
{
"id": "<uuid>",
"value": {
"highest": "<number>",
"total": "<number>"
}
}
]
4. Get Single Logged In Gamer Statistic
- Method & Path:
GET /:id
- Description: Retrieves single statistic for the logged-in gamer, optionally filtered by a date range.
- Headers:
Authorization
: Required for authenticated access.
- URL Parameters:
id
: Id of the statistic to fetch
- Query Parameters:
from
(optional): The start date for filtering statistics. Must be a valid date string represented in ISO 8601 format.to
(optional): The end date for filtering statistics. Must be a valid date string represented in ISO 8601 format.
- Response Body: An array of statistics, each containing:
id
: Unique identifier for the statistic.value
: The value of the statistic containingtotal
: Sum of the stat valuehighest
: Highest sat value
cURL Command
curl --request GET \
--url https://api.yarsaplay.com/api/v1/stats/__ID__ \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
{
"id": "<uuid>",
"value": {
"highest": "<number>",
"total": "<number>"
}
}