Jump to content
Lyrositor

API Suggestions Mega-Thread

Recommended Posts

On 11/13/2017 at 4:11 PM, Lyrositor said:

Ongoing War IDs in Nation API: it would be very useful to see a list of a nation's ongoing wars in the Nation API.

To go along with this, ongoing war IDs in the Alliance API would be pretty sweet. 

EDIT BY ALEX: This has been done.

  • Upvote 2

Share this post


Link to post
Share on other sites

I've updated the Nation API to include the following:

offensivewars

defensivewars

offensivewar_ids

defensivewar_ids

But for the time being I can't push these changes live yet. Expect them in the next week or two.

  • Upvote 3

Share this post


Link to post
Share on other sites
On 13/11/2017 at 10:11 PM, Lyrositor said:
  • Radiation and Season in API (personal suggestion): this is something I would find useful (not sure if others would), but a way to get the radiation level and season for a nation would be nice (in the nation API ideally). 

I second this one

Also, LYRO IS BACK!!

  • Upvote 1

Share this post


Link to post
Share on other sites

My request is very simple and particular that would be of help to a current spreadsheet project I'm working on.

Would it be possible to include the "offensivewars" and "defensivewars" indexes that are current found in the nation (singular) api and add it to the nations (plural) api? In other words can you add these keys from the nation api to the nation list api? Thanks.

  • Upvote 1

Share this post


Link to post
Share on other sites
20 hours ago, Dynamic said:

My request is very simple and particular that would be of help to a current spreadsheet project I'm working on.

Would it be possible to include the "offensivewars" and "defensivewars" indexes that are current found in the nation (singular) api and add it to the nations (plural) api? In other words can you add these keys from the nation api to the nation list api? Thanks.

I am okay with this so long as it is an option. I'll add it to the list.

  • Upvote 3

Share this post


Link to post
Share on other sites

Treaty API. So that I can know what alliances have treaties.. and accordingly rule out those alliances or identify from my sheets.

  • Upvote 1

Share this post


Link to post
Share on other sites
On 12/28/2017 at 6:52 AM, WarGamer said:

Treaty API. So that I can know what alliances have treaties.. and accordingly rule out those alliances or identify from my sheets.

Added.

  • Upvote 2

Share this post


Link to post
Share on other sites

I figured I'd link my previous posts about the API, and then include some extra stuff below.

Other notes:

  • All API pages should have the header media type of "application/json"
  • All date/times should be in the format "1990-12-31T23:00:00Z". Dates are fine as "1990-12-31"
  • Date Founded for Alliances API should be called "founded" (this seems to be standard), not "founddate"
  • Alliance API is missing Date Founded
  • Versioning: Should accept the HTTP Header "X-PNWAPI-Version" (or similar), which should just contain a simple version number, eg "1.9.0". If there is no header, it defaults to the latest version.
  • Authentication: Should accept the HTTP Header "Authorization", which should contain "Bearer: <api_key>", eg "Bearer: 6ecf12cc109d9a". If there is no header, it should return the json "{error: "Not Authorised"}" or similar (this allows you to rate limit all API requests then).
  • Result Filtering: Allow the results to be filtered, example "api/nations/?filter=id:lte:1000" (all nations with a nation id less than or equal to 1000)
  • Field Selection: Allow the fields to be altered from the default, example "api/nations/?fields=id,name,leader,alliance_id"
    • Of course, these can be both combined into "api/nations/?fields=id,name,leader,alliance_id&filter=id:lte:1000"

Alternate suggestion for API endpoints (as opposed to my above posts). Might be overkill.

api/orbis/
- current game information
{
	orbis_date: <date>, //eg 1990-12-31
	server_time: <date/time> //eg 1990-12-31T23:00:00Z
	season: <string>, //one of summer/autumn/winter/spring
	radiation: {
		global: <decimal>,
		africa: <decimal>,
		...
	}
}

api/orbis/nations/
- all nations, default to the fields listed in my above post

api/orbis/nations/<nation_id>/
- specific lookup for a nation

api/orbis/nations/<nation_id>/cities/
- all cities for a nation

api/orbis/nations/<nation_id>/cities/<city_id>/
api/orbis/cities/<city_id>/
- specific lookup of a city

api/orbis/nations/<nation_id>/cities/<city_id>/improvements/
api/orbis/cities/<city_id>/improvements/
- all improvements for a city

api/orbis/nations/<nation_id>/improvements/
- all improvements for a nation (to save having to loop through the above API endpoint

api/orbis/nations/<nation_id>/military/
- military information and stats for the nation
{
	soldiers: 1000,
	...
	stats: {
		soldiers: {
			casualties: 200,
			killed: 500
		},
		...
	}
}

api/orbis/nations/<nation_id>/projects/
- project information for the nation

api/orbis/nations/<nation_id>/wars/
- list all wars for a particular nation
      
api/orbis/alliances/
- all alliances, default to the fields listed in my above post
      
api/orbis/alliances/<alliance_id>/
- specific lookup of an alliance

api/orbis/alliances/<alliance_id>/members/
- list of all nations in the alliance (as per api/orbis/nations/ defaults), including those on vacation and leaders/heirs/officers, excluding applicants

api/orbis/alliances/<alliance_id>/leaders/
api/orbis/alliances/<alliance_id>/heirs/
api/orbis/alliances/<alliance_id>/officers/
- list all nations with only the specific roles 

api/orbis/alliances/<alliance_id>/applicants/
- list of all nations who are applicants to the alliance

api/orbis/alliances/<alliance_id>/members/resources/
- list the resources of an alliance's members
{
	{
		id: <integer>, //nation_id
		coal: <decimal>,
		...
		money: <decimal>
	},
	...
}

api/orbis/alliances/<alliance_id>/applicants/resources/
- list the resources of an alliance's applicants

api/orbis/alliances/<alliance_id>/bank/
- list of all bank records
- use filters to restrict to just tax records

api/orbis/alliances/<alliance_id>/bank/resources/
- list the resources stored in the alliance's bank
{
	coal: <decimal>,
	...
	money: <decimal>
}

api/orbis/alliances/<alliance_id>/wars/
- list of wars for the alliance

api/orbis/market/
- summary of market information for all resources

api/orbis/market/<resource_name>/
- summary of market information for a specific resource

api/orbis/market/<resource_name>/buy_offers/
- all buy offers currently available

api/orbis/market/<resource_name>/sell_offers/
- all buy offers currently available

api/orbis/treaties/
api/orbis/treaties/<alliance_id>/

 

  • Upvote 4

Share this post


Link to post
Share on other sites

I just fixed a bug where there was a discrepancy between the rank shown in the Nation API and the rank shown on the view nation page caused by the API taking into account nations in vacation mode.

  • Upvote 3

Share this post


Link to post
Share on other sites

The Nation API now includes the nation's local radiation index and what season the nation is currently in. @Lyrositor

Radiation is listed as "radiation_index" and should return a float

Season is listed as "season" and should return "spring" "summer" "autumn" or "winter"

@Shakyr "beige_turns_left" has been added as a field in the Nation API.

  • Upvote 3

Share this post


Link to post
Share on other sites

It would be awesome if the War API had fields for kills, casualties, and looting  that happened in that particular war. Basically the "Total Losses" chart , but in the API.

  • Upvote 1

Share this post


Link to post
Share on other sites

I’ll reiterate:

It would make my, and a dozen other people’s life a hecktonne easier. 

  • Upvote 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and the Guidelines of the game and community.