Jump to content

API Discussion


Alex
 Share

Recommended Posts

  • Administrators

Just wanted to create a thread discussing the P&W API, which is slowly becoming more useful. Discuss what pages you'd like to see an API for, or what information you'd like to see added to existing API pages.

 

Currently we have an API page for:

 

Nation (example: https://politicsandwar.com/api/nation/id=5511 )

Alliance (example: https://politicsandwar.com/api/alliance/id=1039 )

City (example: https://politicsandwar.com/api/city/id=10614 )

  • Upvote 1

Is there a bug? Report It | Not understanding game mechanics? Ask About It | Got a good idea? Suggest It

Forums Rules | Game Link

Link to comment
Share on other sites

When I saw this, the first thing I thought was Armor Piercing Incendiary ammo. Do I need help? 

No you just need more ammo

  • Upvote 5

Resident DJ @ Club Orbis

Founder of The Warehouse

 

Link to comment
Share on other sites

  • Administrators

it would be REALLY nice if the alliance page at least had the number of nations in an AA and color.

 

and

 

if the nation had UID

 

Bit of an oversight by me, I suppose.

 

I've added members, applicants, and colors to the alliance API page.

 

I've also added UID to the nation API page.

Is there a bug? Report It | Not understanding game mechanics? Ask About It | Got a good idea? Suggest It

Forums Rules | Game Link

Link to comment
Share on other sites

  • Administrators

Maaan... now I'm gonna have to recode. :P

 

Also in city api, manufacturing/oilrefineries not displaying

Got it now. Thanks!

Is there a bug? Report It | Not understanding game mechanics? Ask About It | Got a good idea? Suggest It

Forums Rules | Game Link

Link to comment
Share on other sites

No listing of City IDs on Nation API, means you can't navigate from Nation to City.

 

Possibly change "cities" to an array of city IDs (and they can just count the array, to find the number of cities).

 

List of wars and list of trades (accessible by Nation ID, each list item with a unique ID), would be useful too.

sig_cybernations.PNG.8d49a01423f488a0f1b846927f5acc7e.PNG

Link to comment
Share on other sites

No listing of City IDs on Nation API, means you can't navigate from Nation to City.

 

Possibly change "cities" to an array of city IDs (and they can just count the array, to find the number of cities).

 

List of wars and list of trades (accessible by Nation ID, each list item with a unique ID), would be useful too.

eh,cities are too much and not really useful. I'd leave it the way it is.

Link to comment
Share on other sites

No listing of City IDs on Nation API, means you can't navigate from Nation to City.

 

Possibly change "cities" to an array of city IDs (and they can just count the array, to find the number of cities).

 

List of wars and list of trades (accessible by Nation ID, each list item with a unique ID), would be useful too.

 

I agree city IDs need to be on the nation API. Right now there is no way to go from the nation API to the city API using code. You have to manually look up the nations city ids in game to use the city API.

Link to comment
Share on other sites

Being able to go to a nation page based on nation name could be a nice addition. So using either ID or Nation Name for the same feed. Either that, or a search API that lets you find the nation ID by searching a nation name to then use the ID to pull the nation page.

 

I think an array of city IDs in the Nation page would be a good thing. 

 

List of nations in an alliance would be good.

 

And as Ontry requested, market feeds.

Edited by dmjohnston

☾☆

Priest of Dio

º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸

¨°º¤ø„¸ GOD EMPEROR DIO BRANDO¨°º¤ø„¸

¨°º¤ø„¸ DIO BRANDO GOD EMPEROR¨°º¤ø„¸

¨°º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸

Link to comment
Share on other sites

eh,cities are too much and not really useful. I'd leave it the way it is.

Please elaborate, as to how cities are too much and not really useful. Because I'm pretty lost, as to what you're trying to say.

 

To explain my point again though, just incase you didn't understand.

 

As mentioned, by myself and others, there is currently no way to go from the Nation API to the City API, without manually looking up City IDs ingame yourself. All I asked for, was a simple quality of life change, so that the API flowed a bit nicer.

sig_cybernations.PNG.8d49a01423f488a0f1b846927f5acc7e.PNG

Link to comment
Share on other sites

Nation API is great for looking up individual players.  Is there a database with all players in though?

 

It would be nice to be able to have a tool where you could select criteria (e.g. alliance, active in 24hrs/3 days/7 days/etc, score range, nuclear weapons capability, etc) and generate a list with the stats of every nation that meet the criteria.  If this could then be exported to a .csv file then it would be awesome.  Leaving the filters blank would give you all nations in the game.

 

This is something that used to be available in the game Mensa members used to play until the idiot admins abandoned the API.  The tools were created by users but the citizen feed as it was known was a part of the API.

 

It might have to run off a single database that is autmatically updated at a set time once a day though rather than being live, as lots of people requesting live info would cause issues.

 

It would save a lot of trauling through individual nation pages to find the info you want.  Is this something that's achievable?

Edited by Dan77
Link to comment
Share on other sites

The only thing that worries me about having everything accessible by API is the amount of automation that people will be able to create. With the PW.Tools everything requires user interaction. What's being asked for is already achievable (I already store all nations and city information once a day), but having it all API accessible just begs for people to automate a lot of processes.

duskhornexceptional.png.d9e24adf7f0945530780eee694428f27.png

 

He's right, I'm such a stinker. Play my exceptional game!

Link to comment
Share on other sites

The only thing that worries me about having everything accessible by API is the amount of automation that people will be able to create. With the PW.Tools everything requires user interaction. What's being asked for is already achievable (I already store all nations and city information once a day), but having it all API accessible just begs for people to automate a lot of processes.

Having Nation/City/War/Trade information available via API, means that it is readily accessible to more people, without them having to scrape and parse the website. Which requires some pretty specific knowledge and skills. I should know, I taught myself how to scrape Nation/Alliance/Trade screens, for a certain other game. I've actually been waiting for the API, before I do any large coding projects for PnW, simply because scraping and parsing webpages is resource intensive.

 

There is precedent already, for putting limits on some types of scripting, with the current bans on Market Trading. So I don't see an issue there. Plus, the API is read only. So not like you'll be able to automate running a nation, using it. Tools may make recommendations, but the user will still have to login and make the changes to their nation, themselves.

Edited by Shakyr

sig_cybernations.PNG.8d49a01423f488a0f1b846927f5acc7e.PNG

Link to comment
Share on other sites

Having Nation/City/War/Trade information available via API, means that it is readily accessible to more people, without them having to scrape and parse the website. Which requires some pretty specific knowledge and skills. I should know, I taught myself how to scrape Nation/Alliance/Trade screens, for a certain other game. I've actually been waiting for the API, before I do any large coding projects for PnW, simply because scraping and parsing webpages is resource intensive.

 

There is precedent already, for putting limits on some types of scripting, with the current bans on Market Trading. So I don't see an issue there. Plus, the API is read only. So not like you'll be able to automate running a nation, using it. Tools may make recommendations, but the user will still have to login and make the changes to their nation, themselves.

 

Lastly, your website is not the only way to go about displaying/caching the information and other people have other ideas. They are perfectly within their rights, to write their own tools, within the limits set by Sheepy.

 

I'm quite aware that it's not, nor was I insinuating it should be. I'm merely raising the thought to Sheepy to make sure that he has limits in place for automation. he didn't have it in place or protection from trading for a while and it got abused quite a bit.

duskhornexceptional.png.d9e24adf7f0945530780eee694428f27.png

 

He's right, I'm such a stinker. Play my exceptional game!

Link to comment
Share on other sites

I'm quite aware that it's not, nor was I insinuating it should be. I'm merely raising the thought to Sheepy to make sure that he has limits in place for automation. he didn't have it in place or protection from trading for a while and it got abused quite a bit.

Retracted my comment. Was a misread.

 

I do agree that limits should be put in place, like requests per timeframe. Though with that, it would be ideal if you could request information about the status of any limits. See https://dev.twitter.com/rest/public/rate-limitingfor example.

 

A "developer" API key, that could be requested from within https://politicsandwar.com/account/or similar, would give a unique way to restrict access to the API (and better keep track, of who is making requests). Restricted to one per nation, of course (and lost if the nation is deleted).

sig_cybernations.PNG.8d49a01423f488a0f1b846927f5acc7e.PNG

Link to comment
Share on other sites

I'm not sure why everyone is against automation >.>

 

For me, one of the best parts about eRepublik was developing tools with the API and later the scraper that replaced it when their developers shit the bed.

 

There is always someone who can make the data public enough to allow automation, so why not make it easily accessible for all and level the playing field?

☾☆

Priest of Dio

º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸

¨°º¤ø„¸ GOD EMPEROR DIO BRANDO¨°º¤ø„¸

¨°º¤ø„¸ DIO BRANDO GOD EMPEROR¨°º¤ø„¸

¨°º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸

Link to comment
Share on other sites

In the alliance page, the alliance color doesn't have quotes around the color name. I was smashing my head for a while wondering why it wouldn't work but the nation page works.

Edited by Yosodog
  • Upvote 1

[22:37:51] <&Yosodog> Problem is, everyone is too busy deciding which top gun character they are that no decision has been made

 

BK in a nutshell

Link to comment
Share on other sites

In the alliance page, the alliance color doesn't have quotes around the color name. I was smashing my head for a while wondering why it wouldn't work but the nation page works.

 

I read this and then completely forgot about it when I was trying to parse alliance data.

 

Sheepy, please fix.

☾☆

Priest of Dio

º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸

¨°º¤ø„¸ GOD EMPEROR DIO BRANDO¨°º¤ø„¸

¨°º¤ø„¸ DIO BRANDO GOD EMPEROR¨°º¤ø„¸

¨°º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸

Link to comment
Share on other sites

Just so all tracking the thread are aware, the alliance feed issue has been fixed.

 

Also, the array of city ID's is live in the nation feed.

  • Upvote 1

☾☆

Priest of Dio

º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸

¨°º¤ø„¸ GOD EMPEROR DIO BRANDO¨°º¤ø„¸

¨°º¤ø„¸ DIO BRANDO GOD EMPEROR¨°º¤ø„¸

¨°º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸

Link to comment
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...
 Share

  • 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.