LewAndrade / wishlist-api

Wishlist API made with Flask and Mongo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wishlist API

This is a REST API to a Wishlist application made using Flask and MongoDB.

Install

docker-compose build

Run the app

docker-compose up -d

REST API

The API is hosted at http://localhost:5000/api/v1.

User SignUp

For Creating a new User account.

Request

URL: POST /auth/signup

{
  "email": "<string>",
  "password": "<string --min-length:6>"
}
body

Response

{
  "id": "<user_id>"
}
body

User Login

By sending a User's correct credentials you receive an JWT bearer token.

Request:

URL: POST /auth/signup

{
  "email": "<string>",
  "password": "<string min-length:6>"
}
body

Response

{
  "token": "<jwt-bearer-token>"
}
body

Authentication required endpoints

All request on the API besides User Signup and User Login requires the user to be logged in.
To do so, use the JWT bearer token retrieved at User Login as the Authentication method for the requests.|


Get Wishlist

Get the Wishlist of the current user.

Request:

URL: GET /wishlist

Response

[
  {
    "_id": {
      "$oid": "<wish_id>"
    },
    "name": "<string>",
    "description": "<string>",
    "url": "<string>",
    "image": "<string>",
    "added_by": {
      "$oid": "<user_id>"
    }
  }
]
body

Get Random Wish

Get a random wish from the User's Wishlist.

Request:

URL: GET /wishlist/random

Response

{
  "_id": {
    "$oid": "<wish_id>"
  },
  "name": "<string>",
  "description": "<string>",
  "url": "<string>",
  "image": "<string>",
  "added_by": {
    "$oid": "<user_id>"
  }
}
body

Get Wish

Get a single wish from the user's Wishlist.

Request:

URL: GET /wishlist/<wish_id>

Response

{
  "_id": {
    "$oid": "<wish_id>"
  },
  "name": "<string>",
  "description": "<string>",
  "url": "<string>",
  "image": "<string>",
  "added_by": {
    "$oid": "<user_id>"
  }
}
body

Update Wish

Update a wish from the User's Wishlist.

Request:

URL: PUT /wishlist/<wish_id>

{
  "name": "<string:optional>",
  "description": "<string:optional>",
  "url": "<string:optional>",
  "image": "<string:optional>"
}
body

Response

"Wish updated"
body

Delete Wishlist

Update a wish from the User's Wishlist.

Request:

URL: DELETE /wishlist

Response

"Wish deleted"
body

About

Wishlist API made with Flask and Mongo


Languages

Language:Python 96.5%Language:Dockerfile 3.5%