Skip to content
Sean Goller edited this page Jul 10, 2014 · 8 revisions

Basic Authentication

curl -v -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST 
http://localhost:3000/api/v2/users/sign_in -d "{\"user_login\":{\"email\":\"email\",\"password\":\"pwd\"}}"

Match Entry

curl -X POST -H "Content-Type: application/json" -d '{
"class": "Druid", 
"oppclass": "Warlock",
"result": "Victory",
"coin":"false", 
"mode":"Ranked", 
"oppname":"Reynad", 
"slot":2, 
"notes":"Owned Him"}' 
localhost:3000/api/v2/matches/new?auth_token=secret

To create other match types, simply use "mode":"Arena" or "mode":"Casual".

Parameters

  • userkey - required
  • mode - Accepts Arena, Casual, and Ranked
  • class - The player's class (e.g. "Mage", "Hunter", etc.)
  • oppclass - The opponent's class (e.g. "Mage", "Hunter", etc.)
  • result - The result of the match - accepts Victory, Defeat, Draw
  • coin - Whether or not the user had the coin - accepts true, false
  • numturns - The number of turns the user had in the match
  • duration - The duration of the match in seconds
  • notes - Any notes to add to the match
  • slot - The deck slot number from 1 to 9 - required when mode is Casual or Ranked
  • ranklvl - If mode is Ranked this will set the exact rank level - accepts 1 to 25

New Arena Run

curl -X POST -H "Content-Type: application/json" -d '{ "class": "Druid" }' 
localhost:3000/api/v2/arena_runs/new?auth_token=secret

Show User's Decks

http://localhost:3000/api/v2/decks/show?auth_token=1ksXxGzZLY2jx9SaTWDT

Custom Match Queries

This will allow developers to retrieve any matches of the user and thus calculate any stats specific to the user.

Parameter

You can pass in any of these

mode: 1, 2, 3
result: 1, 2, 3
klass: 1, 2, 3, 4, 5, 6, 7, 8, 9
oppclass: 1, 2, 3, 4, 5, 6, 7, 8, 9
coin: true, false
season: [integer], 0 for current season
deck_id: id number of the deck to constrain results to

Mode: [1, Arena], [2, Casual], [3, Ranked] Result: [1, Victory], [2, Defeat], [3, Draw] Classes are in this order: ["Druid", "Hunter", "Mage", "Paladin", "Priest", "Rogue", "Shaman", "Warlock", "Warrior"]

Example query:

http://localhost:3000/api/v2/matches/query?auth_token=secret&mode=2,3&result=2&coin=true

To Do:

Support for multiple field still need to be done, this should be completed very soon.