GET /species
Retrieves all existing species. Data is masked for species that have not been discovered by current trainer.
URL
https://api.pokedexercice.ch/species
Parameters
Name | Validation | Description |
---|---|---|
search (optional) | string, minimum length: 3 | If provided only discovered species whose name partially match the search will be returned. |
filters[types] (optional) | array of string | Retrieves only the species that matches all the provided types. |
page (optional) | integer, minimum: 1 | Returns a specific page of species. Defaults to 1. |
per_page (optional) | integer, minimum: 1 | The number of species to return per page. If not provided, it will default to 10 if page is provided, otherwise 150 so that all species are returned. |
Types
Existing types are:
- grass
- poison
- fire
- flying
- water
- bug
- normal
- electric
- ground
- fairy
- fighting
- psychic
- rock
- steel
- ice
- ghost
- dragon
Return
200
{ id: number; name: string; image: string; types: string[];}[]
Examples
Paginated request
fetch('https://api.pokedexercice.ch/species?page=7&per_page=4', { method: 'GET', headers: {'Authorization': `Bearer MY_PERSONAL_TOKEN`}});
Response
{ "data": [ // I have discovered this species, full info is available { "id": 25, "name": "pikachu", "image": "https:\/\/raw.githubusercontent.com\/PokeAPI\/sprites\/master\/sprites\/pokemon\/other\/official-artwork\/25.png", "types": [ "electric" ] },
// I have not discovered species below, only the id is available, the rest is masked { "id": 26, "name": "???", "image": "https:\/\/placehold.co\/475x475?text=?", "types": [] }, { "id": 27, "name": "???", "image": "https:\/\/placehold.co\/475x475?text=?", "types": [] }, { "id": 28, "name": "???", "image": "https:\/\/placehold.co\/475x475?text=?", "types": [] } ], "page": 7, "per_page": 4, "total": 150}
With search text
fetch('https://api.pokedexercice.ch/species?search=chu', { method: 'GET', headers: {'Authorization': `Bearer MY_PERSONAL_TOKEN`}});
Response
Note that “Raichu” is not included in the response because I haven’t discovered it.
{ "data": [ { "id": 25, "name": "pikachu", "image": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/25.png", "types": [ "electric" ] } ], "page": 1, "per_page": 150, "total": 1}
With types filter
Note the empty braces to indicate that
filters[types]
is an array
fetch('https://api.pokedexercice.ch/species?filters[types][]=grass&filters[types][]=poison', { method: 'GET', headers: {'Authorization': `Bearer MY_PERSONAL_TOKEN`}});
Response
{ "data": [ { "id": 1, "name": "bulbasaur", "image": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/1.png", "types": [ "grass", "poison" ] }, { "id": 2, "name": "ivysaur", "image": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/2.png", "types": [ "grass", "poison" ] }, { "id": 3, "name": "venusaur", "image": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/3.png", "types": [ "grass", "poison" ] } ], "page": 1, "per_page": 150, "total": 3}