]> git.cworth.org Git - empires-api/blob - api.text
Indicate that sample game API is now at https://families.cworth.org/api/
[empires-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 /liberate/<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, "captures": [] },
58                    { "id": 2, "captures": [1] },
59                    { "id": 3, "captures": [4, 5, 6] },
60                    { "id": 4, "captures": [2] },
61                    { "id": 5, "captures": [] },
62                    { "id": 6, "captures": [] } ]
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 Server
74 ======
75 There's a sample server available at: https://families.cworth.org/api/
76
77 We plan to move this to https://empires.cworth.org at some point.