summaryrefslogtreecommitdiff
path: root/en/players.md
diff options
context:
space:
mode:
authorBrian Corrigan <bcorrigan78@gmail.com>2017-10-04 08:48:13 -0400
committerBrian Corrigan <bcorrigan78@gmail.com>2017-10-04 08:48:13 -0400
commit1542bd5e0533c535a5b4410ff83f1db8956a5acd (patch)
tree0921b175dc5aef422e667125cefe5cf748c788e1 /en/players.md
downloadvainglory-docs-1542bd5e0533c535a5b4410ff83f1db8956a5acd.tar.gz
vainglory-docs-1542bd5e0533c535a5b4410ff83f1db8956a5acd.zip
Initial commit
Diffstat (limited to 'en/players.md')
-rw-r--r--en/players.md195
1 files changed, 195 insertions, 0 deletions
diff --git a/en/players.md b/en/players.md
new file mode 100644
index 0000000..0c0b92f
--- /dev/null
+++ b/en/players.md
@@ -0,0 +1,195 @@
+# Players
+
+Player objects contain aggregated lifetime information about each Player. At this time Players are fairly sparse, but there are plans to add much richer data as it becomes available.
+
+{% method %}
+## Get a single Player
+
+This endpoint retrieves a specific player.
+
+* If a player has changed names, it is possible that there are multiple ID's for a single player name.
+
+* Player renames do not trigger a change on this endpoint. A minimum of 1 match after the rename is required to view the change.
+
+
+**Changes Coming!** - Player resources are not fully defined at this point, but are
+included so that consumers can get basic info (name, etc.) This object will have
+additional data added over the next few months, and may change slightly as data
+moves from the `attributes.stats` object to the main `attributes` object.
+
+
+{% sample lang="shell" %}
+```shell
+curl "https://api.dc01.gamelockerapp.com/shards/na/players/<ID>" \
+ -H "Authorization: Bearer <api-key>" \
+ -H "Accept: application/vnd.api+json"
+```
+
+{% sample lang="java" %}
+```java
+//There are a variety of Java HTTP libraries that support query-parameters.
+```
+
+{% sample lang="python" %}
+```python
+
+```
+
+{% sample lang="ruby" %}
+```ruby
+
+```
+
+{% sample lang="js" %}
+```javascript
+
+```
+
+{% sample lang="go" %}
+```go
+
+```
+
+{% sample lang="swift" %}
+```swift
+import Foundation
+
+let urlString = "https://api.dc01.gamelockerapp.com/shards/na/players?filter[playerNames]=PlayerIGN"
+
+let url = NSURL(string: urlString)
+var downloadTask = URLRequest(url: (url as URL?)!, cachePolicy: URLRequest.CachePolicy.ReloadIgnoringCacheData, timeoutInterval: 20)
+
+downloadTask.httpMethod = "GET"
+
+downloadTask.addValue("apiKey", forHTTPHeaderField: "Authorization")
+downloadTask.addValue("application/vnd.api+json", forHTTPHeaderField: "Accept")
+
+URLSession.shared.dataTask(with: downloadTask) { (data, response, error) in
+if let response = response {
+ print(response)
+}
+
+if let data = data {
+ do {
+ let jsonData = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as? NSDictionary
+ print(jsonData!.value(forKey: "data") as Any)
+ } catch {
+ print(error)
+ }
+}
+}.resume()
+
+```
+
+{% common %}
+> The above command returns JSON structured like this:
+
+```json
+{
+"data": {
+ "attributes": {
+ "stats": {
+ "lossStreak": 1,
+ "winStreak": 0,
+ "lifetimeGold": 10536.0
+ },
+ "name": "boombastic04"
+ },
+ "type": "player",
+ "id": "6abb30de-7cb8-11e4-8bd3-06eb725f8a76"
+}
+}
+```
+{% endmethod %}
+
+### HTTP Request
+
+`GET https://api.dc01.gamelockerapp.com/shards/na/players/<ID>`
+
+
+### URL Parameters
+
+Parameter | Description
+--------- | -----------
+ID | The ID of the player to retrieve
+
+{% method %}
+## Get a collection of players
+
+This endpoint retrieves a collection of up to 6 players, filtered by name. Player names are specific to each region.
+
+{% sample lang="shell" %}
+```shell
+curl "https://api.dc01.gamelockerapp.com/shards/na/players?filter[playerNames]=player1,player2" \
+ -H "Authorization: Bearer <api-key>" \
+ -H "Accept: application/vnd.api+json"
+```
+
+{% sample lang="java" %}
+```java
+//There are a variety of Java HTTP libraries that support query-parameters.
+```
+
+{% sample lang="python" %}
+```python
+
+```
+
+{% sample lang="ruby" %}
+```ruby
+
+```
+
+{% sample lang="js" %}
+```javascript
+
+```
+
+{% sample lang="go" %}
+```go
+
+```
+
+{% sample lang="swift" %}
+```swift
+import Foundation
+
+let urlString = "https://api.dc01.gamelockerapp.com/shards/na/players?filter[playerNames]=PlayerIGN1, PlayerIGN2, PlayerIGN3"
+
+let url = NSURL(string: urlString)
+var downloadTask = URLRequest(url: (url as URL?)!, cachePolicy: URLRequest.CachePolicy.ReloadIgnoringCacheData, timeoutInterval: 20)
+
+downloadTask.httpMethod = "GET"
+
+downloadTask.addValue("apiKey", forHTTPHeaderField: "Authorization")
+downloadTask.addValue("application/vnd.api+json", forHTTPHeaderField: "Accept")
+
+URLSession.shared.dataTask(with: downloadTask) { (data, response, error) in
+if let response = response {
+ print(response)
+}
+
+if let data = data {
+ do {
+ let jsonData = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as? NSDictionary
+ print(jsonData!.value(forKey: "data") as Any)
+ } catch {
+ print(error)
+ }
+}
+}.resume()
+
+```
+
+{% endmethod %}
+
+### HTTP Request
+
+`GET https://api.dc01.gamelockerapp.com/shards/na/players`
+
+### Query Parameters
+
+
+Parameter | Default | Description
+--------- | ------- | -----------
+filter[playerNames] | none | Filters by player names. Usage: filter[playerNames]=player1,player2