Server Apis - StephenE/DevoLAN GitHub Wiki

HTTP Status Codes

The following HTTP status codes are used by the API to report errors

  • 400 BadRequest: The operation is impossible due to out of range arguments (e.g. tried to attack with more troops than you have)
  • 401 Unauthorized: The logged in user is not allowed to take that action (e.g. not session owner)
  • 402 PaymentRequired: The operation is impossible due to physical constraints (e.g. two regions aren't connected)
  • 403 Forbidden: Not logged in
  • 404 NotFound: Invalid guid provided (e.g. a bad session id)
  • 405 MethodNotAllowed: Didn't use the correct HTTP verb (e.g. POST instead of GET)
  • 406 NotAcceptable: The operation is impossible due to ownership constraints (e.g. trying to attack a region you own)
  • 409 Conflict: Concurrent action detected (e.g. issued two conflicting attack requests at the same time)
  • 417 ExpectationFailed: Trying to perform an operation, but the session is not in the required round state

/api/Account

Auto-generated by Visual Studio. Deals with authentication!

POST /api/Account/Register

Allows creating a new account. Once you've got an account (which doesn't need any activation or email verification), you can get a OAUTH token to authentication your calls to other apis

/Token

Requires the login details over HTTPS as x-www-form-urlencoded, which looks like this:

`grant_type=password&username="Stephen"&password="Devolan!"

It gives you back a token which you can then pass back in calls to other APIs in the Authorization header.

/api/Game

High level management of a game.

  • Starting a game
  • (Stretch) Configuring the options
  • Asking to join
  • Granting permission to join
  • Marking self as ready for the next round

GET /api/Game/Sessions

Returns an array of all existing sessions (See ISession)

POST /api/Game/StartNewGame

Requires no arguments, creates a new session owned by the authenticated user. Returns an ISession with the Guid of the new session

POST /api/Game/JoinGame?sessionId=guid-as-string

Adds the authenticated user to the specified session. Returns a 404 error if the session doesn't exist. If the user is already in the session, nothing happens.

GET /api/Game/Players?sessionId=guid-as-string

Returns a list of IPlayer present in the specified session. Returns a 404 error if the session doesn't exist.

/api/World

Information feeds about the game world and what's happened in a specified round

  • World layout (which regions connect to which)
  • Reinforcements made
  • Combat & Outcomes
  • Redeployment

/api/Region

A region is always owned by a player. The methods here allow you to query & interact with a specific region in the game world.

  • Get owner details
  • Deploy reinforcements
  • Order attack
  • Get planned attacks
  • Cancel attack
  • Redeploy troops

/api/Nation

Each player runs a nation, so anything that applies to the entire player will go in here.

  • Get Available Reinforcements
  • Get Cards
  • Use Cards
  • Get Mission
⚠️ **GitHub.com Fallback** ⚠️