Pokemon as a service allow you to store and retrieve pokemons
You can retrieve pokemons by their ID or by prefix search, for a
word in one of their field values
HTTP | URL | Action |
---|---|---|
POST | /api/pokemon | Store a pokemon by its pokadex_id |
GET | /api/pokemon/id | Get pokemon by ID id |
GET | /api/pokemon | Get all pokemons |
GET | /api/autocomplete/prefix | Get all pokemons that one of the words in their field values has a prefix prefix |
docker-compose build
docker-compose up -d
docker-compose down
HTTP request:
POST /api/pokemon
{
"pokadex_id": 25,
"name": "Pikachu",
"nickname": "Baruh Ha Gever",
"level": 60,
"type": "ELECTRIC",
"skills": [
"Tail Whip",
"Thunder Shock",
"Growl",
"Play Nice",
"Quick Attack",
"Electro Ball",
"Thunder Wave"
]
}
Response:
{
"pokemon": {
"level": 60,
"name": "Pikachu",
"nickname": "Baruh Ha Gever",
"pokadex_id": 25,
"skills": [
"Tail Whip",
"Thunder Shock",
"Growl",
"Play Nice",
"Quick Attack",
"Electro Ball",
"Thunder Wave"
],
"type": "ELECTRIC"
},
"success": true
}
HTTP request:
GET /api/pokemon/25
Response:
{
"pokemon": {
"level": 60,
"name": "Pikachu",
"nickname": "Baruh Ha Gever",
"pokadex_id": 25,
"skills": [
"Tail Whip",
"Thunder Shock",
"Growl",
"Play Nice",
"Quick Attack",
"Electro Ball",
"Thunder Wave"
],
"type": "ELECTRIC"
},
"success": true
}
HTTP request:
GET /api/pokemon
Response:
{
"pokemons": [
{
"level": 20,
"name": "Bulbasaur",
"nickname": "Gavrial",
"pokadex_id": 1,
"skills": [
"Tackle",
"Growl",
"Vine Whip",
"Poison Powder",
"Sleep Powder",
"Take Down",
"Razor Leaf",
"Growth"
],
"type": "GRASS"
},
{
"level": 60,
"name": "Pikachu",
"nickname": "Baruh Ha Gever",
"pokadex_id": 25,
"skills": [
"Tail Whip",
"Thunder Shock",
"Growl",
"Play Nice",
"Quick Attack",
"Electro Ball",
"Thunder Wave"
],
"type": "ELECTRIC"
}
],
"success": true
}
HTTP request:
GET /api/autocomplete/grow
Response:
{
"pokemons": [
{
"level": 20,
"name": "Bulbasaur",
"nickname": "Gavrial",
"pokadex_id": 1,
"skills": [
"Tackle",
"Growl",
"Vine Whip",
"Poison Powder",
"Sleep Powder",
"Take Down",
"Razor Leaf",
"Growth"
],
"type": "GRASS"
},
{
"level": 60,
"name": "Pikachu",
"nickname": "Baruh Ha Gever",
"pokadex_id": 25,
"skills": [
"Tail Whip",
"Thunder Shock",
"Growl",
"Play Nice",
"Quick Attack",
"Electro Ball",
"Thunder Wave"
],
"type": "ELECTRIC"
}
],
"prefix": "grow",
"success": true
}
Explanation: Both pokemons have a word that starts with 'grow' -
Bulbasaur has a 'Growth' skill, and
Pikachu has a 'Growl' skill