Skip to content
TORNLIFE More

Ranked Wars API

Started by tonyuh [2093883] on in API Development.

11 replies · 482 views · thread synced · 4 days ago · View on torn.com
About this thread

Posts archived: 12 / 12 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
12
Discussion span
→
People posting
4
Likes on archived posts
6
Authority score
53 / 100
Historical score
26 / 100
Story score
33 / 100
Engagement score
58 / 100
tonyuh [2093883]
Hi everyone, I'm trying to figure our how to make ranked war log similar to chain log (https://api.torn.com/faction/?selections=chains) since there is no rankedwars selection under faction endpoint. I tried to use https://api.torn.com/torn/?selections=rankedwars but for some reasons some ranked wars are missing from this selection so my faction's ranked war is missing (forexample rw id 6364).

Is there a way to query just ranked wars for a single faction similar to when you filter for your faction in Faction Warfare page?
tonyuh [2093883]
Thank you, but that doesn't solve my issue because I don't know the war ID in the first place (I looked up 6364 manually from the faction page). Without the rw log api, how do I get all war ID related to my faction from the API?
tonyuh [2093883]
That's what I'm afraid is the case, thanks for your help anyway. I guess I'll just have to periodically save current RW in a database to have all past RW infos.
Omanpx [1906686]
It's probably easier to just do it manually once a month or after each war - at least save the war IDs from the page for use later.
Wolverine [1971836]
Correct me if I'm wrong, but "from/to" doesn't work with the "mainnews" api:

https://api.torn.com/faction/?selections=mainnews&from=1691527023&to=1691529730&key=MYAPIKEY

I was hoping to get the ranked war reports from there...
Wolverine [1971836]
you are right, there is an issue for which I have to decrease "to" parameter instead of increasing "from" parameter to get the next 100 items: now that I do that I can get multiples of 100 mainnews in any timespan range.
Wolverine [1971836]
Thanks to Omanpx's help I made what you require:

you can use
https://api.torn.com/faction/?selections=mainnews&key=

to search for mainnews with the text "rankID=" like this one:

<a class="t-green bold" href = http://www.torn.com/factions.php?step=profile&ID=26437>The Pagans</a> defeated <a class="t-red bold" href = http://www.torn.com/factions.php?step=profile&ID=15222>Carbon Rising</a> in a ranked war [<a href = http://www.torn.com/war.php?step=rankreport&rankID=7485>view</a>]

I repeat the mainnews call every 35 seconds to get different sets of 100 mainnews from a timestamp to another timestamp.

Once you have the rankID then you can call

https://api.torn.com/torn/7485?selections=rankedwarreport&key=

to get the details about the war report with that rankID.