This API sources its data from PokeAPI and retrieves choice data for the first 151 Pokemon.
If you would like to check out that API for yourself please refer to the link below
The PokeAPI is extremely comprehensive (which is great) but the amount of data can be overwhelming.
This API aims to take choice pokedex information from that API
All of the data was retrieved by calling the first 151 "pokemon-species" endpoints.
For example if you wanted to get the first pokemon (bulbasaur) of the "pokemon-species" endpoint you would do the following...
https://pokeapi.co/api/v2/pokemon-species/1
To populate this API, 151 calls were made to the PokeAPI database and all the raw data from those get requests was stored in a JSON file. Then some choice pieces of data were retrieved from that JSON file and stored sequentially in a MongoDB database.
Below is the list of the data points provided with each Pokemon object.
- name
- pokedex number
- habitat
- previous evolutionary form
- mythical status
- legendary status
There are plans to include more data in future versions of this API.
There are a few steps needed to set up the API on your local machine.
-
Fork and clone this repository then navigate to the pokemon_rest-api directory
-
Look in the package.json file and install all of the dependencies
-
Run the fetch.js file in node (this will create a json file for parsing)
node fetch.js
- Navigate to the seed directory and run the seed.js file (to seed the MongoDB database)
node seed.js
- Navigate to the root directory and run the server.js file with nodemon
nodemon server.js
- Finally access the Mongo sever on your local machine with the following url in your choice we browser
Congratulations! You are now set up to make queries to this Pokemon API.
To use the deployed API simply navigate to the following link
https://pokemonrest-api-production.up.railway.app/
This API has Create, Read, Update, and Delete capabilities (Full Crud).
The following routes will allow you to interact with the data in several ways
To show all pokemon in the data base locally
http://localhost:3000/pokemon/all
To show all pokemon in the data base with the deployed API
https://pokemonrest-api-production.up.railway.app/pokemon/all
To show a pokemon by its pokedex number go to the following endpoint
Local
http://localhost:3000/pokedex/1
API
https://pokemonrest-api-production.up.railway.app/pokedex/1
In this case we have reached the endpoint for "1" (bulbasaur), but for any other pokemon, simply changethe last number in the url to anything between 1 and 151.
To show a pokemon by its name go to the following endpoint
http://localhost:3000/pokemon/name/bulbasaur
API
https://pokemonrest-api-production.up.railway.app/pokemon/name/bulbasaur
In this case we have reached the endpoint for bulbasaur, but for any other pokemon, simply change the name in the url to any of the first 151 pokemon and they will show up
To show only mythical pokemon go to the following endpoint
http://localhost:3000/pokemon/mythical
API
https://pokemonrest-api-production.up.railway.app/pokemon/mythical
In this case, all the mythical pokemon will show up (this will only be mew in a fesh dataset)
To show only Legendary pokemon go to the following endpoint
http://localhost:3000/pokemon/legendary
API
https://pokemonrest-api-production.up.railway.app/pokemon/legendary
In this case, all the legendary pokemon will show up (this will be Arcticuno, Zapdos, Moltres and Mewtwo in a fesh dataset)
To show pokemon of a particular habitat use the following endpoint
http://localhost:3000/pokemon/habitat/grassland
API
https://pokemonrest-api-production.up.railway.app/pokemon/habitat/grassland
In this case, all the grassland habitat pokemon will show up. Simply change the last word in the url to a different existing pokemon habitat and all the relevant pokemon will show up.
To show the next pokemon in the evolution chain, simply enter the pokemon name you want to query and you will find out who they evolve into.
http://localhost:3000/pokemon/evolution/bulbasaur
API
https://pokemonrest-api-production.up.railway.app/pokemon/evolution/bulbasaur
In this case, we entered bulbasaur (who evolves into ivysaur), so ivysaur will show up.
It should be noted that if you your pokemon evolves into no one, your search will return nothing.
Also if you want to access all the pokemon in their root form, simply enter "birth" at the end of the url.
To create a new Pokemon make a post request to the follwing endpoint
API
https://pokemonrest-api-production.up.railway.app/pokemon
Format the body of the request in the following manner or else it will be rejected
{
"name": "nodemon",
"pokedexNumber": 152,
"habitat": "rare",
"evolves_from": "birth",
"is_legendary": true,
"is_mythical": true
}
To Delete all pokemon make a Delete request with the following endpoint
http://localhost:3000/pokemon/all
API
https://pokemonrest-api-production.up.railway.app/pokemon/all
To delete a pokemon by its pokedex number make a delete request to the following endpoint
http://localhost:3000/pokedex/1
API
https://pokemonrest-api-production.up.railway.app/pokedex/1
In this case we have reached the endpoint for "1" (bulbasaur) so bulbasaur will be deleted
To delete a pokemon by its name make a delete request to the following endpoint
http://localhost:3000/pokemon/name/bulbasaur In this case we have reached the endpoint for bulbasaur, so bulbasaur will be deleted.
API
https://pokemonrest-api-production.up.railway.app/pokemon/name/bulbasaur
To delete all mythical pokemon make a delete request to the following endpoint
http://localhost:3000/pokemon/mythical
API
https://pokemonrest-api-production.up.railway.app/pokemon/mythical
To delete all Legendary pokemon make a delete request to the following endpoint
http://localhost:3000/pokemon/legendary
API
https://pokemonrest-api-production.up.railway.app/pokemon/legendary
To delete pokemon of a particular habitat make a delete request to the following endpoint
http://localhost:3000/pokemon/habitat/grassland
API
https://pokemonrest-api-production.up.railway.app/pokemon/habitat/grassland
In this case, all the grassland habitat pokemon will be deleted.
To update any of the attributes of the pokemon by name, make a put request to the folliwng endpoint
http://localhost:3000/pokemon/name/bulbasaur
API
https://pokemonrest-api-production.up.railway.app/pokemon/name/bulbasaur
In this, case we are updating one or many of the attributes for bulbasaur by entering his name but any other name can be entered at the end of the url.
In the body of the request you can update one or more of bulbasaur's attributes with the following format
{
"name":"Balboasaur"
}
If you want to update multiple properties of bulbasaur's data. For example, if you want to make him legendary and mythical, do the following...
{
"is_mythical": true,
"is_legendary": true
}
If you want to update a pokemon's attributes by their pokedex number make a put request to the following endpoint.
http://localhost:3000/pokedex/1
API
https://pokemonrest-api-production.up.railway.app/pokedex/1
In this case we are using pokedex number 1 (bulbasaur) but you can put in any number between 1 and 151.
In the body of the request you can update one or more of bulbasaur's attributes with the following format
{
"name":"Balboasaur"
}
You can update multiple properties of bulbasaur's data. For example, if you want to make him legendary and mythical, do the following...
{
"is_mythical": true,
"is_legendary": true
}
Thanks for using my skinny pokemon API for your pokemon query needs. I hope you enjoy it!