A tool to track your Hearthstone collection and decks.
- Create a new user
- Get a list of Cards
- Get a Card's details
- Get Collection
- Add a Card to Collection
- Remove a Card from Collection
- Create a Deck
- Get a list of Decks
- Get details of a Deck
- Update a Deck
- Delete a Deck
POST: /user
Body:
{
"username": "joe_user",
"email": "user@example.com",
"password": "password"
}
Response:
{
"id": 1,
"email": "email@email.com",
"username": "joe_user",
"first_name": "",
"last_name": ""
}
Status Codes:
201
if successful400
if invalid data
GET: /card
Query Parameters:
q
: search termset
: if included filter onbasic
,classic
,reward
,naxx
,gvg
,brm,
tgt,
loe`
Response:
{
"count": 741,
"next": "http://testserver/card/?page=2",
"previous": null,
"results": [
{
"id": 1,
"name": "Mind Control",
"mana": 10,
"hero": "priest",
"card_type": "spell",
"card_set": "basic",
"rarity": "common",
"text": "Take control of an enemy minion.",
"tribe": null,
"attack": null,
"health": null
},
{
"id": 2,
"name": "Prophet Velen",
"mana": 7,
"hero": "priest",
"card_type": "minion",
"card_set": "classic",
"rarity": "legendary",
"text": "Double the damage and healing of your spells and Hero Power.",
"tribe": null,
"attack": 7,
"health": 7
},
...
]
}
Status Codes:
200
if successful400
if invalid query parameters
GET: /card/:id
Response:
{
"health": null,
"mana": 10,
"attack": null,
"card_type": "spell",
"rarity": "common",
"text": "Take control of an enemy minion.",
"card_set": "basic",
"hero": "priest",
"id": 1,
"name": "Mind Control",
"tribe": null
}
Status Codes:
200
if successful404
if does not exist
GET: /collection
Query Parameters:
- query params for filtering
Response:
[
{
"id": 1124,
"mana": 2,
"name": "Wild Growth",
"card_type": "spell",
"count": 3
},
{
"id": 400,
"mana": 1,
"name": "Arcane Missles",
"card_type": "spell",
"count": 2
},
]
Status Codes:
200
if successful400
if invalid query parameters401
if invalid credentials
PUT: /collection/add
Body:
{
"id": 1124,
"count": 2
}
Response:
{
"id": 1124,
"mana": 2,
"name": "Wild Growth",
"card_type": "spell",
"count": 5
}
Status Codes:
200
if successful400
if invalid data401
if invalid credentials404
ifid
does not exist
PUT: /collection/remove
Body:
{
"id": 400,
"count": 1
}
Response:
{
"id": 400,
"mana": 1,
"name": "Arcane Missles",
"card_type": "spell",
"count": 1
}
Status Codes:
200
if successful400
if invalid data401
if invalid credentials404
ifid
does not exist
POST: /deck
Body:
{
"name": "Midrange Druid",
"hero": "druid",
"cards": [
{"id": 1124, "count": 2},
...
]
}
Response:
{
"id": 7,
"name": "Midrange Druid",
"hero": "druid",
"cards": [
{"id": 1124, "count": 2},
...
],
"missing_cards": [],
"mana_curve": [2, 8, 7, 3, 4, 3, 2, 1]
}```
**Status Codes:**
- `201` if successful
- `400` if incorrect data provided
- `409` if unique constraint violation
#### Get a list of Decks
**GET:** `/deck`
**Body:** None
**Response:**
```json
[
{
"name": "Midrange Druid",
"hero": "druid",
"cards": [
{"id": 1124, "count": 2},
...
],
"missing_cards": [],
"mana_curve": [2, 8, 7, 3, 4, 3, 2, 1]
},
{
"name": "Aggro Warrior",
"hero": "warrior",
"cards": [
{"id": 365, "count": 2},
{"id": 447, "count": 1},
...
],
"missing_cards": [],
"mana_curve": [0, 3, 7, 6, 6, 4, 2, 2]
}
]
Status Codes:
200
if successful
GET: /deck/:id
Body: None
Response:
{
"name": "Midrange Druid",
"hero": "druid",
"cards": [
{
"id": 1124,
"mana": 2,
"name": "Wild Growth",
"card_type": "spell",
"class": "druid",
"count": 2
}
],
"missing_cards": [],
"mana_curve": [2, 8, 7, 3, 4, 3, 2, 1]
}
Status Codes:
201
if successful400
if incorrect data provided409
if unique constraint violation
PATCH: /deck/:id
Body:
{
"name": "Aggro Druid"
}
**Notes:**
The following fields can be edited:
- `name`
- `cards`
**Response:**
```json
{
"name": "Aggro Druid",
"hero": "druid",
"cards": [
{
"id": 1124,
"mana": 2,
"name": "Wild Growth",
"card_type": "spell",
"class": "druid",
"count": 2
},
...
],
"missing_cards": [],
"mana_curve": [2, 8, 7, 3, 4, 3, 2, 1]
}
Status Codes:
200
if successful400
if incorrect data provided401
if invalid or missing auth404
if deck is not found409
if unique constraint violation
DELETE: /deck/:id
Body: None
Response: None
Status Codes:
204
if successful404
if deck not found