summaryrefslogtreecommitdiff
path: root/source/matches/matches.rst
blob: ef71a91e16a31baad51fa4352a9a1bbfae120fc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
.. _matches:

Matches
=======

Matches records are created every time players complete a game session. Each Match contains high level information about the game session, including info like duration, gameMode, and more. Each Match has two Rosters.


Rosters
----------------------

Rosters track the scores of each opposing group of Participants. If players entered matchmaking as a team, the Roster will have a related Team. Rosters have many Participants objects, one for each member of the Roster. Roster objects are only meaningful within the context of a Match and are not exposed as a standalone resource.

**Javascript:**

.. code-block:: javascript

  {
    "type": "roster",
    "id": "eca49808-d510-11e6-bf26-cec0c932ce01",
    "attributes": {
      "stats": {
        "acesEarned": 2,
        "gold": 32344,
        "etc..."
      }
    },
    "relationships": {
      "team": {
        "data": {
          "type": "team",
          "id": "753d464c-d511-11e6-bf26-cec0c932ce01"
        }
      },
      "participants": {
        "data": [
          {
            "type": "participant",
            "id": "eca49a7e-d510-11e6-bf26-cec0c932ce01"
          },
          "etc..."
        ]
      }
    }
  }



Participants
---------------------------

Participant objects track each member in a Roster. Participants may be anonymous Players, registered Players, or bots. In the case where the Participant is a registered Player, the Participant will have a single Player relationship. Participant objects are only meaningful within the context of a Match and are not exposed as a standalone resource.

**Javascript:**

.. code-block:: javascript

  {
    "type": "participant",
    "id": "ea77c3a7-d44e-11e6-8f77-0242ac130004",
    "attributes": {
      "actor": "*Hero009*",
      "stats": {
        "assists": 4,
        "crystalMineCaptures": 1,
        "deaths": 2,
        "farm": 49.25,
        "etc..."
      }
    }
  }



Get a Collection of Matches
---------------------------

This endpoint retrieves data from matches. Bulk scraping matches is prohibited.

**HTTP Request**
|  ``GET https://api.dc01.gamelockerapp.com/shards/na/matches``

=========================== ================ =================================================================================================================== 
Parameter                   Default          Description                                               
=========================== ================ ===================================================================================================================
page[offset]                0                 Allows paging over results                                     
page[limit ]                50                The default (and current maximum) is 50.Values less than 50 and great than 2 are supported.             
sort                        createdAt         By default, Matches are sorted by creation time ascending.
filter[createdAt-start]     3hrs ago          Must occur before end time. Format is iso8601 Usage: filter[createdAt-start]=2017-01-01T08:25:30Z
filter[createdAt-end]       Now               Queries search the last 3 hrs. Format is iso8601 i.e.filter[createdAt-end]=2017-01-01T13:25:30Z
filter[playerNames]         none              Filters by player name. Usage: filter[playerNames]=player1,player2,...
filter[playerIds]           none              Filters by player Id. Usage:filter[playerIds]=playerId,playerId,...
filter[teamNames]           none              Filters by team names. Team names are the same as the in game team tags. Usage: filter[teamNames]=TSM,team2,...
filter[gameMode]            none              Filter by gameMode Usage: filter[gameMode]=casual,ranked,...
=========================== ================ ===================================================================================================================

*Remember — a happy match is an authenticated match!*

**Shell:**

.. code-block:: shell

    curl -g "https://api.dc01.gamelockerapp.com/shards/na/matches?sort=createdAt&page[limit]=3&filter[createdAt-start]=2017-02-27T13:25:30Z&filter[playerNames]=<playerName>" \
    -H "Authorization: Bearer <api-key>" \
    -H "Accept: application/vnd.api+json"

    //The above command returns JSON structured like this:

    {
    "data": [
      {
        "type": "match",
        "id": "02b90214-c64d-11e6-9f6b-062445d3d668",
        "attributes": {
          "createdAt": "2017-01-06T20:30:08Z",
          "duration": 1482195372,
          "gameMode": "casual",
          "patchVersion": "1.0.0",
          "shardId": "na",
          "stats": "acesEarned: 3, etc..."
        },
        "relationships": {
          "rosters": {
            "data": [{
              "type": "roster",
              "id": "ea77c2eb-d44e-11e6-8f77-0242ac130004"
            }, {
              "type": "roster",
              "id": "dc2c14b4-d50c-11e6-bf26-cec0c932ce01"
            }]
          }
        }
      }
    ]
  }

**Java:**

.. code-block:: java

  //*There are a variety of Java HTTP libraries that support query-parameters.

  //The above command returns JSON structured like this:

  {
    "data": [
      {
        "type": "match",
        "id": "02b90214-c64d-11e6-9f6b-062445d3d668",
        "attributes": {
          "createdAt": "2017-01-06T20:30:08Z",
          "duration": 1482195372,
          "gameMode": "casual",
          "patchVersion": "1.0.0",
          "shardId": "na",
          "stats": "acesEarned: 3, etc..."
        },
        "relationships": {
          "rosters": {
            "data": [{
              "type": "roster",
              "id": "ea77c2eb-d44e-11e6-8f77-0242ac130004"
            }, {
              "type": "roster",
              "id": "dc2c14b4-d50c-11e6-bf26-cec0c932ce01"
            }]
          }
        }
      }
    ]
  }

**Python:**

.. code-block:: python

  import requests

  url = "https://api.dc01.gamelockerapp.com/shards/na/matches"

  header = {
      "Authorization": "<api-key>",
      "Accept": "application/vnd.api+json"
  }

  query = {
      "sort": "createdAt",
      "filter[playerNames]": "<playerName>",
      "filter[createdAt-start]": "2017-02-28T13:25:30Z",
      "page[limit]": "3"
  }

  r = requests.get(url, headers=header, params=query)

  //The above command returns JSON structured like this:

  {
    "data": [
      {
        "type": "match",
        "id": "02b90214-c64d-11e6-9f6b-062445d3d668",
        "attributes": {
          "createdAt": "2017-01-06T20:30:08Z",
          "duration": 1482195372,
          "gameMode": "casual",
          "patchVersion": "1.0.0",
          "shardId": "na",
          "stats": "acesEarned: 3, etc..."
        },
        "relationships": {
          "rosters": {
            "data": [{
              "type": "roster",
              "id": "ea77c2eb-d44e-11e6-8f77-0242ac130004"
            }, {
              "type": "roster",
              "id": "dc2c14b4-d50c-11e6-bf26-cec0c932ce01"
            }]
          }
        }
      }
    ]
  }

**Go:**

.. code-block:: go

  q := req.URL.Query()
  q.Add("sort", "createdAt")
  q.Add("filter[playerNames]", "<playerName>")
  q.Add("filter[createdAt-start]", "2017-02-27T13:25:30Z")
  q.Add("page[limit]", "3")
  req.URL.RawQuery = q.Encode()
  res, _ := client.Do(req)

  //The above command returns JSON structured like this:

  {
    "data": [
      {
        "type": "match",
        "id": "02b90214-c64d-11e6-9f6b-062445d3d668",
        "attributes": {
          "createdAt": "2017-01-06T20:30:08Z",
          "duration": 1482195372,
          "gameMode": "casual",
          "patchVersion": "1.0.0",
          "shardId": "na",
          "stats": "acesEarned: 3, etc..."
        },
        "relationships": {
          "rosters": {
            "data": [{
              "type": "roster",
              "id": "ea77c2eb-d44e-11e6-8f77-0242ac130004"
            }, {
              "type": "roster",
              "id": "dc2c14b4-d50c-11e6-bf26-cec0c932ce01"
            }]
          }
        }
      }
    ]
  }

Get a Single Match
---------------------------

This endpoint retrieves a specific match.

**HTTP Request**
|  ``GET https://api.dc01.gamelockerapp.com/shards/na/matches/<ID>``

**URL Parameters**
|  Parameter: ``ID``
|  Description: ``The ID of the match to retrieve``

**Shell:**

.. code-block:: shell

  curl "https://api.dc01.gamelockerapp.com/shards/na/matches/<matchID>" \
  -H "Authorization: Bearer <api-key>" \
  -H "Accept: application/vnd.api+json"

    //The above command returns JSON structured like this:

  {
    "data": {
      "type": "match",
      "id": "02b90214-c64d-11e6-9f6b-062445d3d668",
      "attributes": {
        "createdAt": "2017-01-06T20:30:08Z",
        "duration": 1482195372,
        "gameMode": "casual",
        "patchVersion": "1.0.0",
        "shardId": "na",
        "stats": "acesEarned: 3, etc..."
      },
      "relationships": {
        "rosters": {
          "data": [{
            "type": "roster",
            "id": "ea77c2eb-d44e-11e6-8f77-0242ac130004"
          }, {
            "type": "roster",
            "id": "dc2c14b4-d50c-11e6-bf26-cec0c932ce01"
          }]
        }
      }
    }
  }

**Javascript:**

.. code-block:: Javascript

    //There are a variety of Java HTTP libraries that support URL parameters

    {
    "data": {
      "type": "match",
      "id": "02b90214-c64d-11e6-9f6b-062445d3d668",
      "attributes": {
        "createdAt": "2017-01-06T20:30:08Z",
        "duration": 1482195372,
        "gameMode": "casual",
        "patchVersion": "1.0.0",
        "shardId": "na",
        "stats": "acesEarned: 3, etc..."
      },
      "relationships": {
        "rosters": {
          "data": [{
            "type": "roster",
            "id": "ea77c2eb-d44e-11e6-8f77-0242ac130004"
          }, {
            "type": "roster",
            "id": "dc2c14b4-d50c-11e6-bf26-cec0c932ce01"
          }]
        }
      }
    }
  }

.. toctree::
  :maxdepth: 2