Cloud Application Development - Team M
Moves people from the given buildings
POST /me/people/move
from=mine&to=lumberjack&number=5
{
"status" : "moved"
}
{
"status" : "error",
"message" : "Number should be a positive integer"
}
{
"status" : "error",
"message" : "Unknown From Building"
}
{
"status" : "error",
"message" : "Unknown To Building"
}
{
"status" : "error",
"message" : "You don't have that kind of building"
}
{
"status" : "error",
"message" : "You don't have that many people"
}
Adds the given building to the given queue (build / level), assuming there isn't anything else in it & you have enough monies
GET /me/building/dock/build
{
"status" : "Build Started",
"building" : "dock",
"secondsLeft" : 600
}
{
"status" : "error",
"message" : "You are already building",
"building" : "dock",
"secondsLeft" : 600
}
{
"status" : "error",
"message" : "Not enough resources!"
}
{
"status" : "error",
"message" : "Unknown Building Type"
}
{
"status" : "error",
"message" : "Unknown action: whateverQueueYouPassed"
}
Creates a new game with the given params
PUT /game/
game_name=Lala&game_type=Public&game_user=Emily
{
"token" : "6e1977af04f54c50842c8db621f5f020",
"nrOfPlayers" : 3,
"name" : "Lala"
}
Lists all games which are waiting and public
GET /game/
{
"games":
[
{
"token" : "6e1977af04f54c50842c8db621f5f020",
"name" : "Lala",
"nrOfPlayers" : 3
}
]
}
Lists the status and members of a game
GET /game/6e1977af04f54c50842c8db621f5f020
{
"status" : "waiting",
"full" : false,
"users" :
[
"Emily",
"Tim",
"Joe"
]
}
Allows a user to join a game and returns basic info about that game
POST /game/6e1977af04f54c50842c8db621f5f020/join
user=Brian
{
"status" : "joined"
}
{
"status" : "ERROR",
"message" : "Unknown Game"
}
{
"status" : "ERROR",
"message" : "Game has started"
}
{
"status" : "ERROR",
"message" : "Username already exists"
}
{
"status" : "ERROR",
"message" : "The maximum number of players has been reached"
}
Starts a game. Can only be performed by the creator of a game
GET /game/6e1977af04f54c50842c8db621f5f020/start
{
"status" : "started"
}
{
"status" : "ERROR",
"message" : "Unknown Game"
}
{
"status" : "ERROR",
"message" : "You are not authorised to start this game"
}
These endpoints should not be used by the application itself. They are purely convenience functions to aid with debug and development
Purges everything in the given table
Game - Contains all the games / information about which members have joined
User - Contains details about users / their money / gold / miltary etc
Purges everything from all tables
Returns the current list of all buildings owned by the user and their levels, and the amount of resources they have
DO NOT PING THIS ENDPOINT EVERY x SECONDS
GET /debug/me
{
"level" : "Hamlet",
"resources" :
{
"gold" : 50,
"wood" : 200,
"food" : 200,
"stone" : 200
},
"buildings" :
{
"dock" :
{
"level" : 1,
"num" : 0,
"people" : 0
},
"storage" :
{
"level" : 1,
"num" : 1
},
...
}
}