| This page documents the API.
This page is about the API for the game. It contains information such as contents, structure, & other miscellany. See Category:API for other pages on the API. |
This endpoint is deprecated and planned to potentially be removed by December 2023. It is recommended to switch to v3 of the API.
The War Attacks API provides information on attacks conducted during wars. Use of this API requires your API key. This API replicates and add to the data provided on the War Timeline Page within the game.
Accessing the API[]
The War Attacks API can be accessed at the following urls:
baseurl/war-attacks/key={key}
baseurl/war-attacks/key={key}&war_id={war_id}
baseurl/war-attacks/key={key}&min_war_attack_id={min_war_id}
baseurl/war-attacks/key={key}&max_war_attack_id={max_war_id}
baseurl/war-attacks/key={key}&min_war_attack_id={min_war_id}&max_war_attack_id={max_war_id}
JSON Example[]
{
"war_attack_id":"3869585",
"date":"2018-11-27 03:21:00",
"war_id":"366133",
"attacker_nation_id":"118693",
"defender_nation_id":"29295",
"attack_type":"naval",
"victor":"118693",
"success":"3",
"attcas1":"0",
"attcas2":"0",
"defcas1":"0",
"defcas2":"0",
"city_id":"61870",
"infra_destroyed":"2.42",
"improvements_destroyed":"1",
"money_looted":"0.00",
"note":"14",
"city_infra_before":"1133.56",
"infra_destroyed_value":"18101.78",
"att_gas_used":"8.00",
"att_mun_used":"12.00",
"def_gas_used":"0.00",
"def_mun_used":"0.00"
}
JSON Interpretation[]
- Unlike many of the P&W APIs, the War Attacks API requires some logic to interpret, please see the following caveats:
- infra_destroyed_value does not seem to calculate correct values in many cases, it is recommended that users of this data manually calculate this field.
- success ranges from 0: Utter Failure to 3: Immense Triumph
- attack_type table
| In-game Type | attack_type | attcas1 | attcas2 | defcas1 | defcas2 | note |
|---|---|---|---|---|---|---|
| Airstrike Infrastructure | airstrike1 | attacking aircraft lost | defending aircraft lost | resistance eliminated | ||
| Airstrike Soldiers | airstrike2 | attacking aircraft lost | defending aircraft lost | defending soldiers lost | resistance eliminated | |
| Airstrike Tanks | airstrike3 | attacking aircraft lost | defending aircraft lost | defending tanks lost | resistance eliminated | |
| Airstrike Money | airstrike4 | attacking aircraft lost | defending aircraft lost | defenders money destroyed | resistance eliminated | |
| Airstrike Ships | airstrike5 | attacking aircraft lost | defending aircraft lost | defending ships lost | resistance eliminated | |
| Airstrike planes | airstrike6 | attacking aircraft lost | defending aircraft lost | resistance eliminated | ||
| Ground Battle | ground | attacking soldiers lost | attacking tanks lost | defending soldiers lost | defending tanks lost | resistance eliminated |
| Launch Missile | missile | resistance eliminated | ||||
| Launch Missile (Failed) | missilef | |||||
| Nuclear Attack | nuke | resistance eliminated | ||||
| Nuclear Attack (Failed) | nukef | |||||
| Naval battle | naval | resistance eliminated | ||||
| Fortify | fotify | |||||
| Peace | peace | |||||
| Beige | victory | message about nation loot | ||||
| Beige | a_loot | message about alliance loot |
Notes[]
- Similar to all of the P&W APIs, the War Attacks API is inconsistent in number typing with some being plain numbers and others as strings. Care should be taken to check data types when using the API.
- The API is in practice delivered as a minified file, the above example has been decompressed for readability.
- The URLs both have forward slashes escaped.
Based on whether or not the war attack ended the war (i.e beiged the enemy), or the attack just reduced resistance, the note field returns either the text containing the infra destroyed percent figure, or the amount of resistance the attack reduced.
Example: If the war attack ended the war, the note field will either contain note: "<NATIONNAME> won the war and looted <looted resources here>. <ENEMYNATIONNAME> also lost 4% of the infrastructure in each of their cities." or just 10 (assuming the attack was an immense triumph ground attack)