Skip to content
TORNLIFE More

Faction attack log help

Started by Splinterx [2761320] on in API Development.

2 replies · 71 views · thread synced · 3 days ago · View on torn.com
About this thread

Posts archived: 3 / 3 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
3
Discussion span
→
People posting
2
Likes on archived posts
1
Authority score
50 / 100
Historical score
16 / 100
Story score
22 / 100
Engagement score
38 / 100
Splinterx [2761320]
Hiya,

I'm trying to get all the attacks during a war to work out some stats, but when executing:

https://api.torn.com/faction/?selections=attacks&from=XXX&key=

unless I drop the from param to every 5 minutes, it seems to be missing loads of attacks from the report but then checking for every 5 minute intervals takes ages and still misses some attacks off. I'm probably missing something dead obvious, but any help would be great.

Thanks
Omanpx [1906686]
Why are you incrementing it by 5 minutes? Attacks only returns 100 results, and there can easily be more than 100 attacks in those 5 minutes. You should use the timestamp of the latest previous result as the new from in each iteration instead, until you hit the war end timestamp. Also, keep in mind there is a 30 sec cache between similar calls with timestamps. Depending on your use case, you might be good with using attacksfull, though that would probably cause you to miss stealthed incoming attacks. If you want some stats on wars, you can also check out Debriefing.

Mentions: [Website] Debriefing - Extended War Reports + AI

Splinterx [2761320]
Thanks Omanpx! I was getting caught out by the cache. Hadn't thought about taking the last timestamp and starting the next call from that either, which is way more efficient then doing 5 minute intervals.