FANDOM



Overview Edit

The Nation API provides information about a given nation.

Access URL Edit

baseurl/nation/id={nation id}

Returned JSONEdit

Below is the JSON for the request of:

accessurl=137331
  • Like all of the P&W APIs the Nation API is inconsistent in number typing with some being plain numbers & others strings. Care should be taken to check data types when using the api.
  • Projects are listed with values of "1" & "0" corresponding to true & false respectively.
  • The "alliancepostion" property is a number code with higher postions having a higher number. Leader = "5", Vice-Leader = "4", Officers = "3", Members = "2", Applicants = "1" There also seems to be a value of -3, which as far as I can tell only occurs in old vacation mode Sunray members.
  • Nations not in an alliance will return "0" for the "allianceid" & "alliancepostion" proporties while the "alliance" property returns "None"
{
    'cityids': ['245169', '245359', '245386', '245614', '246435', '246599', '247088', '247583', '247914', '248473', '255552', '255846', '257650', '259294'],
    'cityprojecttimerturns': 0, 
    'success': True, 
    'nationid': '137331', 
    'name': 'Nation Name', 
    'prename': 'Nation Title', 
    'continent': 'North America', 
    'socialpolicy': 'moderate', 
    'color': 'pink', 
    'minutessinceactive': 13, 
    'uniqueid': '7a1efc6c678b3f6fd191a48a', 
    'government': 'Absolute Monarchy', 
    'domestic_policy': 'Manifest Destiny', 
    'war_policy': 'Fortress', 
    'founded': '2018-10-03 05:44:47', 
    'daysold': 75, 
    'alliance': 'Rose', 
    'allianceposition': '3', 
    'allianceid': '790', 
    'flagurl': 'http://i.imgur.com/69X39mT.png', 
    'leadername': 'Leader Name', 
    'title': 'Leader Title', 
    'ecopolicy': 'left wing', 
    'approvalrating': '269.7535', 
    'nationrank': '711', 
    'nationrankstrings': '711 of 12937 Nations', 
    'nrtotal': 12937, 
    'cities': 14, 
    'latitude': '40.98', 
    'longitude': '-119.23', 
    'score': '2659.51', 
    'population': '1567462', 
    'gdp': '999741372.57', 
    'totalinfrastructure': 16062.4, 
    'landarea': 19000, 
    'soldiers': '207000', 
    'soldiercasualties': '203180', 
    'soldierskilled': '809100', 
    'tanks': '11029', 
    'tankcasualties': '2929', 
    'tankskilled': '10225', 
    'aircraft': '1242', 
    'aircraftcasualties': '782', 
    'aircraftkilled': '1297', 
    'ships': '146', 
    'shipcasualties': '112', 
    'shipskilled': '216', 
    'missiles': '0', 
    'missilelaunched': '0', 
    'missileseaten': '2', 
    'nukes': '0', 
    'nukeslaunched': '0', 
    'nukeseaten': '3', 
    'infdesttot': '9565.13', 
    'infraLost': '2938', 
    'moneyLooted': '26334782.19', 
    'ironworks': '0', 
    'bauxiteworks': '0', 
    'armsstockpile': '0', 
    'emgasreserve': '0', 
    'massirrigation': '0', 
    'inttradecenter': '0', 
    'missilelpad': '0', 
    'nuclearresfac': '0', 
    'irondome': '0',
    'vitaldefsys': '0', 
    'intagncy': '1', 
    'uraniumenrich': '0', 
    'propbureau': '0', 
    'cenciveng': '1', 
    'vmode': '0', 
    'offensivewars': 0, 
    'defensivewars': 0, 
    'offensivewar_ids': [], 
    'defensivewar_ids': [], 
    'beige_turns_left': 0, 
    'radiation_index': 94.079555555556, 
    'season': 'spring'
}

Error JSON Edit

With an incorrect nation id:

{
    'success': False, 
    'error': "Nation doesn't exist."
}
Community content is available under CC-BY-SA unless otherwise noted.