Politics and War Wiki
Register
Advertisement


Overview[]

Developers can connect and request information from the P&W Application Programming Interface, also known as the API, they can then use this information in whichever manner they desire to.

Everything that follows with containing significant amounts of technical information which will read like Latin to the average user, this is because this section is geared towards developers who need to access information in its full technical detail. What the API does is essentially spits out information to build fancy programs that make life easier, if you want to start working with it pick a language and ask for help in the API channel on the main discord server.

You can go to the discussion thread on the forums to suggest things for the API and see how the API evolved from its early days.

Technical Overview[]

Warning: v1 and v2 of the API, and all associated endpoints (except for the /api/send-message endpoint), are deprecated with the potential to be removed by December 2023. It is highly encouraged that you migrate to v3 of the API.

To learn how to access the API, head over to the Accessing the API page which covers how to do exactly that. The goal with it is to cover ho of the APIw to work with the API in several languages so people can pick and choose the language they wish to use for working with the API.

Note[]

  • All API requests will be returned in JSON, and must be parsed to access the specific info
  • The treatment of numbers throughout the API is haphazard and you will find them given as integers, floats, or strings within the same API page.
  • All property names are lowercase.
  • All of the APIs except trade price is minified.
  • All Boolean values are given as 1 or 0.

Base URL For V1[]

The base URL for version 1 used by the P&W API is as follows, with this being referenced as the baseurl/ on specific API endpoint pages.

http://politicsandwar.com/api/{endpoint}

Base URL For V2[]

The base URL for version 2 used by the P&W API is as follows, with this being referenced as the baseurl/ on specific API endpoint pages.

https://politicsandwar.com/api/v2/{endpoint}

Base URL For V3[]

The base URL for version 3 used by the P&W API. This version is the GraphQL version of the P&W API which has the feature of grabbing data from multiple API calls into one call.

https://api.politicsandwar.com/graphql?api_key={apikey}

Playground For V3[]

The URL used to access the web-based playground for version 3 of the P&W API. As above, this version is the GraphQL version of the P&W API which has the feature of grabbing data from multiple API calls into one call.

The "playground" can be used to view the GraphQL schema and models that can be accessed in the API, as well as being a place to easily build and test your queries.

https://api.politicsandwar.com/graphql-playground

API Wrappers[]

Java[]

pw4j

JavaScript[]

pnw4js

pnwkit-js (GraphQL) (No Longer Supported)

pnwkit-2.0 (GraphQL)

Google App Script[]

pnwkit.gs (GraphQL)

Python[]

pnwkit-py (GraphQL)

All items (23)

Advertisement