Closed NoCodeNoBlunder closed 2 months ago
The aggregate endpoint is rate limited to 60 requests per 60 seconds. Even at game speed 4 you only need 9*4 = 36 requests per minute.
If your problem relates to this point
Whenever some action is taken that changes the income, update only the rate of the affected resource.
then you should know that even in Stellaris, the forecast does not update immediately when building something but only at the start of a new month.
I found a way to implement this efficiently. It will be in the next update. The schema will not change though, so the individual items that make up a resource's explanation will be lost. Here is an example:
GET /api/v1/games/{game}/empires/66119f9a0b0f4d8642ee8958/aggregates/resources.periodic
(no query parameters):
{
"total": 416.9276884199139,
"items": [
{
"variable": "resources.credits.periodic",
"count": 1,
"subtotal": 0
},
{
"variable": "resources.population.periodic",
"count": 1,
"subtotal": 13.825438419891725
},
{
"variable": "resources.energy.periodic",
"count": 1,
"subtotal": 258.0250000000233
},
{
"variable": "resources.minerals.periodic",
"count": 1,
"subtotal": 161.11699999999837
},
{
"variable": "resources.food.periodic",
"count": 1,
"subtotal": -148.806
},
{
"variable": "resources.fuel.periodic",
"count": 1,
"subtotal": 24.912500000002183
},
{
"variable": "resources.research.periodic",
"count": 1,
"subtotal": 39.191249999999854
},
{
"variable": "resources.alloys.periodic",
"count": 1,
"subtotal": 47.21249999999782
},
{
"variable": "resources.consumer_goods.periodic",
"count": 1,
"subtotal": 21.450000000000728
}
]
}
Is your feature request related to a problem? Please describe. We would like to give the player a prognose about the passiv income/cost over the next period for all resources. Currently the Server only supports aggregating one Variable at the time which does make this a hard task because of the ratelimit as there is 9 unique resource types.
Describe the solution you'd like The
/api/v1/games/{game}/empires/{empire}/aggregates/{aggregate}
endpoint of the server supports another new aggregateresources.periodic.all
which returns the Schema that look like this example.The
/api/v1/games/{game}/empires/{empire}/aggregates/{aggregate}
would then returnoneOf
two possible option similar to how/api/v1/games/{game}/empires/{empire}
works.It would be nice if you could still query for a specific
System
likeresources.periodic
allows it to get the rate of Change for one specific System.Alternatives:
resources.periodic
acceptsarray[string]
as query parameters for the requested resources similar to how/api/v1/games/{game}/empires/{empire}/variables
can be used to get multiple Variables with one request.Integer
for each resource instead ofAggregateResult
that represent the rate of change, enabling easy rate of change display without all extra details.Describe alternatives you've considered