FAO: API Developers
Hello!
Am implementing some custom reports and such after wars for specific payout etc etc and to do this I heavily rely on a lot of the specific data provided with the faction/attacks endpoint (v2) from the start of the war to the end of the war.
It has been working wonderfully except when last war my report 'lost' one attack randomly, after some thorough investigate it seems the 'automatic' pagination links combined with an awkwardly timed attack resulted in the API providing links that left one attack in the 'gap' between pages.
I've emitted all previous links to get to the current two as they are not relevant to this issue and can be reproduced easily with just these two.
Reference Data:
Initial API request which provides the _meta > previous link to follow to - https://api.torn.com/v2/faction/attacks?&limit=100&sort=desc&from=1734120000&to=1734145229
Followed through link provided by previous request - https://api.torn.com/v2/faction/attacks?&limit=100&sort=desc&from=1734120000&to=1734133561
Missing Attack (redacted attack code):
{
"id": 343224834,
"code": "REDACTED",
"started": 1734133558,
"ended": 1734133563,
"attacker": {
"id": 3404427,
"name": "UncleLeeLee",
"level": 35,
"faction": {
"id": 51716,
"name": "Develop (Hiring)"
}
},
"defender": {
"id": 2855990,
"name": "Lunarfoxx",
"level": 22,
"faction": {
"id": 49924,
"name": "OnlyXans Premium"
}
},
"result": "Attacked",
"respect_gain": 4.48,
"respect_loss": 1.12,
"chain": 1,
"is_interrupted": false,
"is_stealthed": false,
"is_raid": false,
"is_ranked_war": true,
"modifiers": {
"fair_fight": 2.02,
"war": 2,
"retaliation": 1,
"group": 1,
"overseas": 1,
"chain": 1,
"warlord": 1
}
}
As you can see by the timestamps this attack is missed, to verify attack exists you can change the URL to:
https://api.torn.com/v2/faction/attacks?&limit=100&sort=desc&from=1734120000&to=1734133567 and it is the first in the list.
(Not sure how easy this will be for developers to view since you're not in the faction, data for each requested can be sent if that makes it easier.)