Firemind API Documentation

Api::V1::Archetypes

Classify a known tournament deck

Endpoint

POST /api/v1/archetypes/classify.json

Parameters

Name Description
format_name Format (standard, modern, etc) in which decks have to be legal
decklist deck list in text format

Request

Route

POST /api/v1/archetypes/classify.json

Headers

Accept: application/json
Content-Type: application/json
Host: www.firemind.ch
Cookie: 

Body

{
  "format_name": "Modern",
  "decklist": "4 Arcbound Ravager\n4 Blinkmoth Nexus\n4 Cranial Plating\n4 Darksteel Citadel\n4 Etched Champion\n4 Galvanic Blast\n4 Glimmervoid\n4 Inkmoth Nexus\n3 Memnite\n1 Mountain\n4 Mox Opal\n4 Ornithopter\n4 Signal Pest\n1 Spellskite\n4 Springleaf Drum\n2 Steel Overseer\n4 Vault Skirge\n1 Welding Jar\n"
}

cURL

curl "https://www.firemind.ch/api/v1/archetypes/classify.json" -d '{"format_name":"Modern","decklist":"4 Arcbound Ravager\n4 Blinkmoth Nexus\n4 Cranial Plating\n4 Darksteel Citadel\n4 Etched Champion\n4 Galvanic Blast\n4 Glimmervoid\n4 Inkmoth Nexus\n3 Memnite\n1 Mountain\n4 Mox Opal\n4 Ornithopter\n4 Signal Pest\n1 Spellskite\n4 Springleaf Drum\n2 Steel Overseer\n4 Vault Skirge\n1 Welding Jar\n"}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Host: www.firemind.ch" \
	-H "Cookie: "

Response

Simulated Response

Response Fields

Name Description
archetype The best matching archetype
score Score of archetype during classification. Number between 0 and 1. The closer to 1 the better the match.

Status

201

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
ETag: W/"cee1456a1d46ac1c4b38a3bb1372605a"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: request_method=POST; path=/
X-Request-Id: f5781cc0-4d62-4b43-b235-b9b690264a95
X-Runtime: 0.367223
Content-Length: 60

Body

{
  "archetype": {
    "name": "Affinity"
  },
  "score": 0.9996527081286423
}

Api::V1::Decks

Create a deck

Note that the returned deck_list_id does not match the id. The reason for this is that deck_lists are not duplicated on the server and the deck is basically just a reference to the deck_list with a custom name, description and avatar. For creating duels use the deck_list_id.

Endpoint

POST /api/v1/decks.json

Parameters

Name Description
deck deck
deck[title] Name under which the deck is visible to the user
deck[description] Optional description for the deck
deck[decklist] Decklist as text with each line starting with the number of cards followed by the card name. Lines starting with # and blank lines are ignored.
deck[format_name] Format in which the deck is listed for the user (Standard, Modern, Legacy, Vintage or Pauper)

Request

Route

POST /api/v1/decks.json

Headers

Accept: application/json
Content-Type: application/json
Host: www.firemind.ch
Authorization: Token token=f2e703c122c896a02f2da16c32b22688
Cookie: 

Body

{
  "deck": {
    "title": "my test deck",
    "description": "some description of the deck",
    "decklist": "# 16 creatures\n4 Delver of Secrets\n4 Grim Lavamancer\n4 Snapcaster Mage\n4 Young Pyromancer\n\n# 25 spells\n1 Blood Moon\n2 Burst Lightning\n4 Lightning Bolt\n3 Mana Leak\n3 Pillar of Flame\n3 Remand\n1 Spell Pierce\n2 Spell Snare\n1 Sword of Fire and Ice\n1 Twisted Image\n4 Vapor Snag\n\n# 19 lands\n6 Island\n1 Mountain\n4 Scalding Tarn\n3 Steam Vents\n4 Sulfur Falls\n1 Tectonic Edge\n",
    "format_name": "Modern"
  }
}

cURL

curl "https://www.firemind.ch/api/v1/decks.json" -d '{"deck":{"title":"my test deck","description":"some description of the deck","decklist":"# 16 creatures\n4 Delver of Secrets\n4 Grim Lavamancer\n4 Snapcaster Mage\n4 Young Pyromancer\n\n# 25 spells\n1 Blood Moon\n2 Burst Lightning\n4 Lightning Bolt\n3 Mana Leak\n3 Pillar of Flame\n3 Remand\n1 Spell Pierce\n2 Spell Snare\n1 Sword of Fire and Ice\n1 Twisted Image\n4 Vapor Snag\n\n# 19 lands\n6 Island\n1 Mountain\n4 Scalding Tarn\n3 Steam Vents\n4 Sulfur Falls\n1 Tectonic Edge\n","format_name":"Modern"}}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Host: www.firemind.ch" \
	-H "Authorization: Token token=f2e703c122c896a02f2da16c32b22688" \
	-H "Cookie: "

Response

Simulated Response

Status

201

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Location: http://www.firemind.ch/decks/30
Content-Type: application/json; charset=utf-8
ETag: W/"44d6ff3b9e52d432d2f545391ce7acee"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: request_method=POST; path=/
X-Request-Id: 926633bc-bbeb-4576-ac46-4c4a64f13843
X-Runtime: 0.395944
Content-Length: 37

Body

{
  "deck": {
    "id": 30,
    "deck_list_id": 480
  }
}

Api::V1::Duels

Create a duel in custom queue

Endpoint

POST /api/v1/duels.json

Parameters

Name Description
duel duel
duel[format_name] Format (standard, modern, etc) in which decks have to be legal
duel[freeform] If set to true a format is not required and decks will not be checked for legality
duel[deck_list1_id] ID of first deck list
duel[deck_list2_id] ID of second deck list
duel[games_to_play] Number of games the client will play for this duel
duel[public] List duel publically

Request

Route

POST /api/v1/duels.json

Headers

Accept: application/json
Content-Type: application/json
Host: www.firemind.ch
Authorization: Token token=ceec2dba81dbc6c12dbf587eced6aeb3
Cookie: 

Body

{
  "duel": {
    "freeform": true,
    "games_to_play": 5,
    "deck_list1_id": 481,
    "deck_list2_id": 482,
    "public": true
  }
}

cURL

curl "https://www.firemind.ch/api/v1/duels.json" -d '{"duel":{"freeform":true,"games_to_play":5,"deck_list1_id":481,"deck_list2_id":482,"public":true}}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Host: www.firemind.ch" \
	-H "Authorization: Token token=ceec2dba81dbc6c12dbf587eced6aeb3" \
	-H "Cookie: "

Response

Simulated Response

Status

201

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Location: http://www.firemind.ch/duels/13
Content-Type: application/json; charset=utf-8
ETag: W/"be6d2c64fe826345f606ad976c59984a"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: request_method=POST; path=/
X-Request-Id: 107786c6-5b41-40dd-be02-042141ded836
X-Runtime: 0.034665
Content-Length: 18

Body

{
  "duel": {
    "id": 13
  }
}

Api::V1::Status

Client Info

Endpoint

GET /api/v1/status/client_info

Request

Route

GET /api/v1/status/client_info

Headers

Accept: application/json
Content-Type: application/json
Host: www.firemind.ch
Cookie: 

cURL

curl "https://www.firemind.ch/api/v1/status/client_info" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Host: www.firemind.ch" \
	-H "Cookie: "

Response

Simulated Response

Status

200

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
ETag: W/"10273fdf9bb499ead3cfacb4ae37839f"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: f67e6e4e-39ae-4ae6-bc40-e1eb523c56fe
X-Runtime: 0.013994
Content-Length: 90

Body

{
  "current_magarena_version": "1.81",
  "displayText": "Currently running magaren version 1.81"
}