Planets.Nu API

From VGA Planets Wiki
Revision as of 21:17, 20 November 2012 by HandsomeCam (talk | contribs) (Added Login documentation)
Jump to navigationJump to search

On December 21, 2011, Planets.Nu opened up an API for developers.

The public API calls consist of:

  • Login - Use this to acquire the apikey of a given player.
  • List Games - List the games on the Planets Nu platform in various ways
  • Load Game Info - Load the publicly available data about a single game
  • Load Turn Data - Load a single players complete turn package

Errors

API calls return a JSON dictionary. In the event of an API call failure, the following dictionary will be returned:

{"success":false,"error":"This is the error message."}

Login

The login API returns an API key which can be used along with a username for subsequent API calls.

To use the login command HTTP GET to http://api.planets.nu/login with the following values passed on the connection string:

variable description
username account username
password account password

Example:

http://api.planets.nu/login?username=user12345&password=straightouttagalibor

The response is a JSON dictionary with the following keys:

key value
success Indicates if the call was successful (true or false)
apikey The API key used in other requests. An API key is formatted as: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx where any x is a hexadecimal value.
settings The user's general settings as a dictionary

The API key is used for subsequent API calls for the given account. This is the API Key of the account and will only change if the user changes their account password.

References

Official API Documentation