Skip to content
TORNLIFE More

Warring API Info

Started by dingus [3188789] on in API Development.

4 replies · 207 views · thread synced · 5 days ago · View on torn.com
About this thread

Posts archived: 5 / 5 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
5
Discussion span
→
People posting
5
Likes on archived posts
5
Posts by staff, officers and moderators
1
Authority score
73 / 100
Historical score
37 / 100
Story score
31 / 100
Engagement score
49 / 100

Most-liked replies

dingus [3188789]

is there a way to see hits in a war just from an API call?  I want to see who did how many hits specifically, but total hits is helpful too.  Im wondering so i can further automate my google sheet.  

splent [2088243] Admin Staff

Hey, 

Assuming you're talking about ranked wars, in general, you can get information about any ranked war on this endpoint:

https://api.torn.com/torn/{id}?selections=rankedwarreport&key={yourKey}

Given that you're a leader of a faction, you can get your faction's ranked wars like so:
https://api.torn.com/faction/?selections=rankedwars&key={yourKey}

You can also get detailed faction attacks on this endpoints: 
https://api.torn.com/faction/?selections=attacks&key={yourKey}

Or less information, but more attacks here: 
https://api.torn.com/faction/?selections=attacksfull&key={yourKey}

Feel free to explore the API docs here: 
https://www.torn.com/api.html# 

byrod [1132772]

Given that you're a leader of a faction, you can get your faction's ranked wars like so... 

 

Is it connected to being a leader, or more only related to having the faction AA permission. 

 

I thought it was the latter, but now you made me wonder... :-) 

VinceGhi [3261894]

This is what i do to do our faction reports:

  1. Get ongoing/latest war from /faction/?selections=rankedwars
  2. Use the start date to query /faction/?selections=attacks&from={startTimestamp}&to={endTimestamp}
    1. from and to fitlers by timestamp_ended in this case. So add a few seconds to it.
  3. If there are 100 attacks, i get the latest attacked sorted by timestamp_ended and use it as new from-query value
  4. After fetching all attacks i simply check the ranked_war-flag and boom, you got ALL the attacks for the ranked war.
    1. I would also include atacks with the chain-flag tho.. sometimes outside hits have to be made and that should be included imo

 

Side-Note: The bonuses are also included so you can do a very detailed overview of the war. If someone got a chain bonus the modifiers.chain_bonus is the bonus gained... e.g. 10, 25, etc. and can also be 1.10 in case of regular % bonus on "regular" chain hits.