https://sneaker-api-dk.herokuapp.com/
If you do not want to clone the repository, you can use this URL.
For making requests that are described below, use the deployed URL instead of http://localhost:3000
.
https://sneaker-api-dk.herokuapp.com/login
RESTful API where you are able to CRUD Nike and Jordan shoes. Sorting functionality to sort through the different models, types, price, id, etc.
To install this API, clone the repository, open Terminal, and run this command in that directory
npm install
Then run:
npm run dev
All you'll have to do is send a POST request to http://localhost:3000/sign-up
Make sure you have the correct headers with the correct data type:
username: String
password: Password
You will have to login once you have registered for an account
In order to log in, send a POST request to http://localhost:3000/login
Make sure you have the correct headers with the correct data type:
username: String
password: Password
You should now be authenticated. You can check with the route below.
Once you have logged in, you will be provided with a token in the JSON data
- Copy your token value
- Go to authorization tab to the left of the header tab
- Make sure the type of token is Bearer Token
- Paste your token value in the Token input field
In order to make requests, you have to be authorized to do so. Without providing your token value, you will not be able to make requests for /api/shoes
Send a GET request to URL localhost:3000/api/shoes
to get a list of all shoes.
Data will look like:
[
{
_id: '5e614d4711f7e59691d10626',
name: 'White Cement',
model: 'Air Jordan 3',
type: 'basketball',
year: '1988',
SKU: '31456-002',
price: '225.00'
}
]
The SKU is the 9 character long string located on the size tag of the shoe.
In order to GET request a specific shoe, copy the _id field of the specific shoe and paste it to the end of the URL.
Example:
http://localhost:3000/api/shoes/5e614d4711f7e59691d10626
Make a POST request on http://localhost:3000/api/shoes
and refer to the following names and values:
name: String
model: String
type: String
year: Number
SKU: String
price: Number
Add these key-value pairs in the Body tab
Amazing! You just created a new shoe in the API!
Send a PUT request to a specific shoe with the shoe id at the end of the URL
Update any information that is in the body tab and then the specific shoe object should update its information
Send a DELETE request to a specific shoe with the shoe id at the end of the URL.
After making the request, it should redirect you to http://localhost:3000/api/shoes
with the shoe you wanted to delete removed from the list.