WhiskyBored API

A RESTful CRUD API for educational purposes


Endpoints

* Requires authorization

To authorize access to specific endpoints, set the Authorization header of your request to be Bearer followed by the token you received at login

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1YmY1ODFkYTNkMWM2MjQyM2IxMmZjYjYiLCJpYXQiOjE1NDI4MTYyNzYsImV4cCI6MTU0MjgzNzg3Nn0.hAOyxDk9puDhMJ6nOowdfa8vpfYIp1wX8kzEOJoZ-3Y

/register

POST /register
Example request
POST {BASE_URI}/register
Parameters
Property Data type Additional info
username String Required
email String Required
password String Required
passwordConfirmation String Required
Example payload
{
  "username": "mickyginger",
  "email": "mike.hayden@ga.co",
  "password": "pass",
  "passwordConfirmation": "pass"
}
Example response
200 OK
{
  "message": "Registration successful"
}
                                

/login

POST /login
Example request
POST {BASE_URI}/login
Parameters
Property Data type Additional info
email String Required
password String Required
Example payload
{
  "email": "mike.hayden@ga.co",
  "password": "pass"
}
                                
Example response
200 OK
{
  "message": "Welcome back mickyginger!",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1YmY1ODFkYTNkMWM2MjQyM2IxMmZjYjYiLCJpYXQiOjE1NDI4MTYyNzYsImV4cCI6MTU0MjgzNzg3Nn0.hAOyxDk9puDhMJ6nOowdfa8vpfYIp1wX8kzEOJoZ-3Y"
}
                                

/whiskies

GET /whiskies
INDEX ROUTE
Example request
GET {BASE_URI}/whiskies
Example response
200 OK
[
  {
    "id": "2c90cdc67c51cf5f017c51cf75c50001",
    "name": "Dalmore 15 y.o.",
    "origin": "Scotland",
    "image": "{BASE_URI}/images/dalmore.jpg",
    "tastingNotes": "Soft and very approachable, with dried fruit, hazelnuts and dry spiciness. Rich, classic Christmas-cake notes of raisins, currants, cherries, cinnamon and nutmeg. Sweet and raisiny, this rich-tasting dram lingers for a long time.",
    "user": {
      "id": "2c9157327c55cc65017c55cc8ae40000",
      "username": "mickyginger",
      "email": "mike.hayden@ga.co"
    }
  },
  {
    "id": "2c90cdc67c51cf5f017c51cf75c50002",
    "name": "Bunnahabhain 12 y.o.",
    "origin": "Scotland",
    "image": "{BASE_URI}/images/bunnahabhain.jpg",
    "tastingNotes": "A rich and fruity Islay single malt from Bunnahabhain, matured for 12 years in ex-sherry casks, creating aromas of dried fruit, sweet flowers, oak spice and rich smoke on the nose. The palate offers notes of roast hazelnuts, vanilla, caramel, raisins and dates that linger in the finish.",
    "user": {
      "id": "2c9157327c55cc65017c55cc8ae40000",
      "username": "mickyginger",
      "email": "mike.hayden@ga.co"
    }
  },
  ...
]
                                
POST /whiskies *
CREATE ROUTE
Example request
POST {BASE_URI}/whiskies
Parameters
Property Data type Additional info
name String Required
origin String Required
image String Required
tastingNotes String Max 380 characters
Example payload
{
"name": "Dalwhinnie 15 Year Old",
"origin": "Scotland",
"image": "https://img.thewhiskyexchange.com/900/dalob.15yov5.jpg",
"tastingNotes": "Dalwhinnie 15yo is a good introduction to the delights of single malt whisky - elegant, smooth and medium-bodied with a light, fruity palate and a whiff of heather on the finish."
}
                                
Example response
201 Created
{
  "id": "402881517c50ebed017c50ed587f0004",
  "name": "Dalwhinnie 15 Year Old",
  "origin": "Scotland",
  "image": "https://img.thewhiskyexchange.com/900/dalob.15yov5.jpg",
  "tastingNotes": "Dalwhinnie 15yo is a good introduction to the delights of single malt whisky - elegant, smooth and medium-bodied with a light, fruity palate and a whiff of heather on the finish.",
  "user": {
    "id": "2c9157327c55cc65017c55cc8ae40000",
    "username": "mickyginger",
    "email": "mike.hayden@ga.co"
  }
}
                                

/whiskies/:id

GET /whiskies/:id
SHOW ROUTE
Example request
GET {BASE_URI}/whiskies/2c90cdc67c51cf5f017c51cf75c50001
Example response
200 OK
{
    "id": "2c90cdc67c51cf5f017c51cf75c50001",
    "name": "Dalmore 15 y.o.",
    "origin": "Scotland",
    "image": "{BASE_URI}/images/dalmore.jpg",
    "tastingNotes": "Soft and very approachable, with dried fruit, hazelnuts and dry spiciness. Rich, classic Christmas-cake notes of raisins, currants, cherries, cinnamon and nutmeg. Sweet and raisiny, this rich-tasting dram lingers for a long time.",
  "user": {
    "id": "2c9157327c55cc65017c55cc8ae40000",
    "username": "mickyginger",
    "email": "mike.hayden@ga.co"
  }
}
                                
PUT /whiskies/:id *
UPDATE ROUTE
Example request
PUT {BASE_URI}/whiskies/2c90cdc67c51cf5f017c51cf75c50001
Parameters
Property Data type Additional info
name String Required
origin String Required
image String Required
tastingNotes String Max 380 characters
Example payload
                                {
                                  "name": "Bunnahabhain 12 y.o.",
                                  "origin": "Scotland",
                                  "image": "{BASE_URI}/images/bunnahabhain.jpeg",
                                  "tastingNotes": "Modified tasting notes"
                                }
                                
Example response
200 OK
{
  "id": "5bf69d5b115e7252c5e6b911",
  "name": "Bunnahabhain 12 y.o.",
  "origin": "Scotland",
  "image": "{BASE_URI}/images/bunnahabhain.jpeg",
  "tastingNotes": "Modified tasting notes",
  "user": {
    "id": "2c9157327c55cc65017c55cc8ae40000",
    "username": "mickyginger",
    "email": "mike.hayden@ga.co"
  }
}
                                
DELETE /whiskies/:id *
DELETE ROUTE
Example request
DELETE {BASE_URI}/whiskies/2c90cdc67c51cf5f017c51cf75c50001
Example response
204 No Content

/users/:username

GET /users/:username
SHOW ROUTE
Example request
GET {BASE_URI}/users/mickyginger
Example response
200 OK
{
    "id": "2c9157327c55cc65017c55cc8ae40000",
    "username": "mickyginger",
    "email": "mike.hayden@ga.co",
    "whiskies": [
        {
            "id": "2c90cdc67c51cf5f017c51cf75c50001",
            "name": "Dalmore 15 y.o.",
            "origin": "Scotland",
            "image": "{BASE_URI}/images/dalmore.jpg",
            "tastingNotes": "Soft and very approachable, with dried fruit, hazelnuts and dry spiciness. Rich, classic Christmas-cake notes of raisins, currants, cherries, cinnamon and nutmeg. Sweet and raisiny, this rich-tasting dram lingers for a long time."
        },
        {
            "id": "2c90cdc67c51cf5f017c51cf75c50002",
            "name": "Bunnahabhain 12 y.o.",
            "origin": "Scotland",
            "image": "{BASE_URI}/images/bunnahabhain.jpg",
            "tastingNotes": "A rich and fruity Islay single malt from Bunnahabhain, matured for 12 years in ex-sherry casks, creating aromas of dried fruit, sweet flowers, oak spice and rich smoke on the nose. The palate offers notes of roast hazelnuts, vanilla, caramel, raisins and dates that linger in the finish."
        },
        ...
    ]
}