Giter VIP home page Giter VIP logo

api-test's Introduction

Movies API documentation

for this project to work it is necessary to provide some key values in the .env file (if running locally)

Parameter Type Description
API_PORT string Required. Port where the API will run
TOKEN_KEY string Required. key to validate the jwt token
REFRESH_TOKEN_KEY string Required. key to validate the jwt refresh token
DB_URL string Required. Atlas MongoDB url

Users Requests

POST /register
Parameter Type Description from
first_name string Required. User first name body
last_name string Required. User last name body
email string Required. User email body
password string Required. User password body
admin string default: false. Specified when creating an administrator account body

Responses

  • 400 - "All inputs are required"
  • 409 - "User already exists"
  • 201 - User information generated in object format :
{
    "first_name": first name provided by user,
    "last_name": last name provided by user,
    "email": email provided by user,
    "password": hashed password provided by user,
    "admin": false by default,
    "_id": id generated in mongoDB,
    "__v": 0,
    "token": jwt access token generated and stored in bearer header
}
POST /login
Parameter Type Description from
email string Required. User email body
password string Required. User password body

Responses

  • 400 - "Invalid email or password"
  • 401 - "Invalid token"
  • 200 - User information stored in database :
{
   "_id": user mongoDB id,
   "first_name": first name,
   "last_name": last name,
   "email": user email,
   "password": user hashed password,
   "admin": false by default,
   "__v": 0,
   "token": access token
}
GET /:id
Parameter Type Description from
id string Required. User id req.params
token string Required. User access token bearer Header

Responses

  • 400 - "Cannot find user"
  • 401 - "Invalid token"
  • 200 - User information stored in database :
{
   "_id": mongoDB id,
   "first_name": user first name,
   "last_name": user last name,
   "email": email,
   "password": hashed password,
   "admin": false by default,
   "__v": 0
}
DELETE /:id
Parameter Type Description from
id string Required. User id req.params
token string Required. User access token bearer Header

Responses

  • 400 - "generic error"
  • 401 - "Invalid token"
  • 200 - "User successfully deleted"
PUT /:id

send the parameter that the user intent to change

Parameter Type Description from
first_name string Optional User first name body
last_name string Optional User last name body
email string Optional User email body
password string Optional User password body
admin string Optional Specified when creating an administrator account body
token string Optional User access token bearer Header

Responses

  • 400 - "generic error"
  • 401 - "Invalid token", "You are not allowed to do this"
  • 200 - It will return an object with the information of the user already updated :
{
   "first_name": first name provided by user,
   "last_name": last name provided by user,
   "email": email provided by user,
   "password": hashed password provided by user,
   "admin": false by default,
   "_id": id generated in mongoDB,
   "__v": 0,
}
GET /logout

Responses

  • 400 - "generic error"
  • 200 - "Successfully loged out user", set the access token to empty string in header
GET /all-users

Responses

  • 400 - "generic error"
  • 401 - "Invalid token", "You are not allowed to see this request"
  • 200 - It will return all users stored in database in object format

Movies Requests

POST /register-movie
Parameter Type Description from
movieName string Optional User first name body
releasedYear string Optional User last name body
description string Optional User email body
movieGenre string Optional User password body
access token string Reequired User password bearer header

Responses

  • 400 - "generic error"
  • 401 - "Invalid token", "You are not allowed to see this request"
  • 200 - Created movie :
{
    "name": Movie name provided by the user,
    "released_year": Movie released year provided by the user,
    "synopsis": Movie description provided by the user,
    "genre": Movie genre provided by the user,
    "_id": Movie id generated in MongoDB,
    "__v": 0,
    "uploadedBy": user id
}
GET /catalog/:id
Parameter Type Description from
id string Required Movie id req.params
token string Required User access name bearer Header

Responses

  • 400 - "Cannot find movie"
  • 401 - "Invalid token", "You are not allowed to see this request"
  • 200 - Movie content :
{
    "_id": Movie id,
    "name": Movie name,
    "released_year": Movie release year,
    "synopsis": Movie description,
    "genre": Movie genre,
    "__v": 0,
    "uploadedBy": id from User that uploaded the Movie
}
GET /catalogo
Parameter Type Description from
token string Required User access name bearer Header

Responses

  • Unable to finish this request

api-test's People

Contributors

joaomaarinho avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.