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.
Overview[]
The Nations API provides a listing of every nation that currently exists along with some basic information.
- Nations are listed by rank from highest to lowest.
- This api even minified is extremely large & has lengthy parse times.
Access URL[]
There are a few restrictions that can be employed through the URL. These restrictions allow you to include Vacation Mode nations if you choose, set a minimum and/or maximum score threshold, and filter to a single alliance.
The Nations API can be accessed at these urls:
baseurl/nations/?key={api key} baseurl/nations/?key={api key}&vm=true baseurl/nations/?key={api key}&min_score={score} baseurl/nations/?key={api key}&max_score={score} baseurl/nations/?key={api key}&alliance_id={alliance id}
The Nations API can also be accessed through a combination of these flags, using the & operator to concatenate restrictions. Below is one example of all restrictions being employed, but it is not necessary to use all URL restrictions if you don't want to.
baseurl/nations/?key={api key}&vm=true&min_score=X&max_score=Y&alliance_id=Z
Returned JSON[]
- The Nations API is structured as an array 'Nations' with each array element being an object representing a single nation.
{
"nations": [
// a bunch of nations
{
'nationid': 123224,
'nation': 'United States of Israel',
'leader': 'Obama Bin Laden',
'continent': 'North America',
'war_policy': 'Covert',
'color': 'gray',
'alliance': 'None',
'allianceid': 0,
'allianceposition': 0,
'cities': 1,
'infrastructure': 0.17,
'offensivewars': 0,
'defensivewars': 0,
'score': 0,
'rank': 12945,
'vacmode': 1419,
'minutessinceactive': 219385}
}
// even more nations
]
}