]> git.cworth.org Git - lmno-api/blob - api.text
Specify an initial REST API for playing a game of Empires
[lmno-api] / api.text
1 Gameplay API endpoints (within a current game)
2 ==============================================
3 /register
4
5     Method: POST
6
7     Behavior: Adds a new player with "name" and "character" and assigns an id. Also will add a new empire with empty "captured" array
8
9     Example data: { "name": "Carl", "character: "Elvis" }
10
11 /deregister/<ID>
12
13     Method: POST
14
15     Behavior: Removes an existing player with the given ID
16
17 /reset
18
19     Method: POST
20
21     Behavior: Removes all players (bulk deregister)
22
23 /restart
24
25     Method: POST
26
27     Behavior: Eliminates all current empire ownership so the existing
28     players can start a new game
29
30 /capture/<ID1>/<ID2>
31
32     Method: POST
33
34     Behavior: Indicate that empire ID1 has now captured ID2
35
36 /escape/<ID>
37
38     Method: POST
39
40     Behavior: Indicate that empire ID is no longer captured (undoing a
41     previous /capture)
42
43 /characters
44
45     Method: GET
46
47     Behavior: Returns a lists of all character names (in alphabetical order)
48
49     Example data: [ "Einstein", "Elvis", "Fred Flintstone" ]
50
51 /empires
52
53     Method: GET
54
55     Behavior: Shows which empires have been captured by other empires
56
57     Example data [ { "id": 1, "captured": [] },
58                    { "id": 2, "captured": [1] },
59                    { "id": 3, "captured": [4, 5, 6] },
60                    { "id": 4, "captured": [2] },
61                    { "id": 5, "captured": [] },
62                    { "id": 6, "captured": [] } ]
63
64 /players
65
66     Method: GET
67
68     Behavior: Gets a list of all the player objects (without their
69     character names)
70
71     Example data: [ { id: 1, name: "Carl" }, { id: 2, name: "Kevin" } ]
72
73 /players/<id>
74
75     Method: GET
76
77     Behavior: Get a single player by its id
78
79 Server
80 ======
81 There's a sample server available at: https://families.cworth.org/
82
83 We plan to move this to https://empires.cworth.org at some point.