Skip to content

arif05rachman/e-commerce-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

e-commerce

E-Commerce

User Register


Returns json data.

  • URL

    /register

  • Method:

    POST

  • URL Params

    Required:

None

  • Data Params

    name=[string]

    email=[string]

    password=[string]

  • Success Response:

    Input

    name = 'Arif Rachman Husen''
    
    email = '[email protected]'
    
    password = '12345'
    

    Response

    • Code: 201 OK
      Content:

      `{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhcmlmIiwiaWF0IjoxNTgxNjY0NTgzfQ.mRMIr1EyfdKXrj86mPrQogjY5XQiL6VvWR-xi8UEYdw"}`
      
  • Error Response:

    Input

    name = ''
    
    email = arif05rachman.com
    
    password = ''
    

    Response

    • Code: 400 BadRequest
      Content: { "message": [ "User.password cannot be null", "Validation isEmail on email failed", "Validation notEmpty on name failed", ] }

    OR

    Input

    name = 'Arif Rachman Husen''
    
    
    email = '[email protected]'
    
    password = '12345'
    

    Response

    • Code: 409 Conflict
      Content: { "message": "Email already register" }
  • Sample Call:

    axios
    .post(`${process.env.BASE_URL}/register`,{
        name:name ,username:username ,email:email ,password:password
    })

User Login


Returns json data.

  • URL

    /login

  • Method:

    POST

  • URL Params

    Required:

None

  • Data Params

    email=[string]

    password=[string]

  • Success Response:

    Input

    email = '[email protected]'
    
    password = '12345'
    

    Response

    • Code: 200 OK
      Content:

      `{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhcmlmIiwiaWF0IjoxNTgxNjY0NTgzfQ.mRMIr1EyfdKXrj86mPrQogjY5XQiL6VvWR-xi8UEYdw"}`
      
  • Error Response:

    Input

    email = ''
    
    password = ''
    

    Response

    • Code: 400 BadRequest
      Content: { "message": [ "User.password cannot be null", "Validation isEmail on email failed", ] }

    OR

    Input

    email = '[email protected]'
    
    password = 'qwerty'
    

    Response

    • Code: 401 Unauthorize
      Content: { "message": "Email or Password wrong" }

    OR

    Input

    email = '[email protected]'
    
    password = '12345'
    

    Response

    • Code: 404 Not Found
      Content: { "message": "User Not Found" }
  • Sample Call:

    axios
    .post(`${process.env.BASE_URL}/login`,{
        email:email ,password:password
    })

Admin Login


Returns json data.

  • URL

    /loginAdmin

  • Method:

    POST

  • URL Params

    Required:

None

  • Data Params

    email=[string]

    password=[string]

  • Success Response:

    Input

    email = '[email protected]'
    
    password = '12345'
    

    Response

    • Code: 200 OK
      Content:

      `{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhcmlmIiwiaWF0IjoxNTgxNjY0NTgzfQ.mRMIr1EyfdKXrj86mPrQogjY5XQiL6VvWR-xi8UEYdw"}`
      
  • Error Response:

    Input

    email = ''
    
    password = ''
    

    Response

    • Code: 400 BadRequest
      Content: { "message": [ "User.password cannot be null", "Validation isEmail on email failed", ] }

    OR

    Input

    email = '[email protected]'
    
    password = 'qwerty'
    

    Response

    • Code: 401 Unauthorize
      Content: { "message": "Email or Password wrong" }

    OR

    Input

    email = '[email protected]'
    
    password = '12345'
    

    Response

    • Code: 404 Not Found
      Content: { "message": "User Not Found" }
  • Sample Call:

    axios
    .post(`${process.env.BASE_URL}/login`,{
        email:email ,password:password
    })

Admin Add


Returns json data.

  • URL

    /user

  • Method:

    POST

  • URL Params

    Required:

  • Header:

    token : `<secretToken>`
    
  • Data Params

    name=[string]

    email=[string]

    password=[string]

  • Success Response:

    Input

    name = 'Arif Rachman Husen''
    
    email = '[email protected]'
    
    password = '12345'
    
    admin = true
    

    Response

    • Code: 201 OK
      Content:

      `{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhcmlmIiwiaWF0IjoxNTgxNjY0NTgzfQ.mRMIr1EyfdKXrj86mPrQogjY5XQiL6VvWR-xi8UEYdw"}`
      
  • Error Response:

    Input

    name = ''
    
    email = arif05rachman.com
    
    password = ''
    

    Response

    • Code: 400 BadRequest
      Content: { "message": [ "User.password cannot be null", "Validation isEmail on email failed", "Validation notEmpty on name failed", "Validation notEmpty on username failed" ] }

    OR

    Input

    name = 'Arif Rachman Husen''
    
    
    email = '[email protected]'
    
    password = '12345'
    

    Response

    • Code: 409 Conflict
      Content: { "message": "Email already register" }
  • Sample Call:

    axios
    .post(`${process.env.BASE_URL}/user`,{
        name:name ,email:email ,password:password
    })

Read All User


Returns json data.

  • URL

    /user

  • Method:

    GET

  • URL Params

     none
    
  • Data Body none

  • Success Response:

    input header

      token : `<secretToken>`
    

    input body

    • Code: 200 OK
      Content: [ { "id": 3, "name": "Bob", "email": "[email protected]", "password": <hasedpassword>, "admin": true, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" },{ "id": 4, "name": "Jack", "email": "[email protected]", "password": <hasedpassword>, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" } ]
  • Error Response:

    input header

      token : ``
    

    input body

      none
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }
  • Sample Call:

    axios
    .get(`${process.env.BASE_URL}/user`)

Read One User


Returns json data.

  • URL

    /user/id

  • Method:

    GET

  • URL Params

     `id:3
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

      none
    
  • Success Response:

    input header

      token : `<secretToken>`
    

    input body

    • Code: 200 OK
      Content: { "id": 3, "name": "Carrier", "email": [email protected], "password": 30, "admin": true, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
  • Error Response:

    input header

      token : ``
    

    input body

      none
    
    • Code: 404 BadRequest
      Content: { "message": "token require" }

OR

  • Error Response:

    input header

      token : `<secretToken>`
    

    input body

      none
    
    • Code: 404 NotFound
      Content: { "message": "Data Not Found" }
  • Sample Call:

    axios
    .get(`${process.env.BASE_URL}/user/id`)

Update User


Returns json data.

  • URL

    /user/id

  • Method:

    PUT

  • URL Params

     `id:[integer]`
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

      `name=[string]`
    
      `email=[string]`
    
      `password=[string]`
    
  • Success Response:

    params

      id : `3`
    

    input header

      token : `<secretToken>`
    

    input body

      id : 3
    
      name: Carrier,
    
      email: [email protected],
    
      password: password
    
    • Code: 200 OK
      Content: { "id": 3, "name": "Carrier", "email": [email protected], "password": <hasedpassword>, "admin": true, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
  • Error Response:

    params

      id : `3`
    

    input header

      token : `<secretToken>`
    

    input body

      name: ,
    
      email: [email protected],
    
      password: password
    
    • Code: 400 BadRequest
      Content: { "message": [ "Validation notEmpty on name failed", ] }

OR

  • Error Response:

    params

      id : `3`
    

    input header

      token : ``
    

    input body

      name: name,
    
      email: [email protected],
    
      password: password
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }

OR

  • Error Response:

    params

      id : `90`
    

    input header

      token : `<secretToken>`
    

    input body

      name: name,
    
      email: [email protected],
    
      password: password
    
    • Code: 404 NotFound
      Content: { "message": "Data Not Found" }
  • Sample Call:

    axios
    .put(`${process.env.BASE_URL}/user/id`,{
        name:name ,email: email@email.com ,password:"12345"
    })
    

Delete User


Returns json data.

  • URL

    /user/id

  • Method:

    DELETE

  • URL Params

     `id:[integer]`
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

  • Success Response:

    params

      id : `3`
    

    input header

      token : `<secretToken>`
    

    input body

      none
    
    • Code: 200 OK
      Content: data succes delete
  • Error Response:

    params

      id : `3`
    

    input header

      token : ``
    

    input body

      none
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }

OR

  • Error Response:

    params

      id : `90`
    

    input header

      token : `<secretToken>`
    

    input body

      none
    
    • Code: 404 NotFound
      Content: { "message": "Data Not Found" }
  • Sample Call:

    axios
    .delete(`${process.env.BASE_URL}/user/id`,{
        name:name ,email:email@email.com ,password:<hassedpassword> 
    })

Create Product


Returns json data.

  • URL

    /products

  • Method:

    POST

  • URL Params

     none
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

      `name=[string]`
    
      `image_url=[string]`
    
      `price=[integer]`
    
      `stock=[integer]`
    
  • Success Response:

    input header

      token : `<secretToken>`
    

    input body

      name: Carrier,
    
      image_url: http://localhost:3000/assets/image/product.jpg,
    
      price: 200000,
    
      stock: 30
    
    • Code: 200 OK
      Content: { "id": 3, "name": "Carrier", "image_url": "http://localhost:3000/assets/image/product.jpg", "price": 200000, "stock": 30, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
  • Error Response:

    input header

      token : `<secretToken>`
    

    input body

      name: ,
    
      image_url: http://localhost:3000/assets/image/product.txt,
    
      price: -200000,
    
      stock: '30'
    
    • Code: 400 BadRequest
      Content: { "message": [ "Validation notEmpty on name failed", "Validation imageExtention on image_url failed", "Validation notNegativeValue on price failed", "Validation isNumber on stock failed" ] }

OR

  • Error Response:

    input header

      token : ``
    

    input body

      name: Carrier,
    
      image_url: http://localhost:3000/assets/image/product.jpg,
    
      price: 200000,
    
      stock: 30
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }
  • Sample Call:

    axios
    .post(`${process.env.BASE_URL}/products`,{
        name:name ,image_url:image_url ,price:200000 ,stock:30
    })

Read All Product


Returns json data.

  • URL

    /products

  • Method:

    GET

  • URL Params

     none
    

    Header:

     token : `<secretToken>`
    
  • Data Body none

  • Success Response:

    input header

      token : `<secretToken>`
    

    input body

    • Code: 200 OK
      Content: [ { "id": 3, "name": "Carrier", "image_url": "http://localhost:3000/assets/image/product.jpg", "price": 200000, "stock": 30, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" },{ "id": 4, "name": "Boots", "image_url": "http://localhost:3000/assets/image/product2.jpg", "price": 100000, "stock": 20, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" } ]
  • Error Response:

    input header

      token : ``
    

    input body

      none
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }
  • Sample Call:

    axios
    .get(`${process.env.BASE_URL}/products`)
    

Read One Product


Returns json data.

  • URL

    /products/id

  • Method:

    GET

  • URL Params

     `id:3
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

      none
    
  • Success Response:

    input header

      token : `<secretToken>`
    

    input body

    • Code: 200 OK
      Content: { "id": 3, "name": "Carrier", "image_url": "http://localhost:3000/assets/image/product.jpg", "price": 200000, "stock": 30, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
  • Error Response:

    input header

      token : ``
    

    input body

      none
    
    • Code: 404 BadRequest
      Content: { "message": "token require" }

OR

  • Error Response:

    input header

      token : `<secretToken>`
    

    input body

      none
    
    • Code: 404 NotFound
      Content: { "message": "Data Not Found" }
  • Sample Call:

    axios
    .get(`${process.env.BASE_URL}/products/id`)
    

Update Product


Returns json data.

  • URL

    /products/id

  • Method:

    PUT

  • URL Params

     `id:[integer]`
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

      `name=[string]`
    
      `image_url=[string]`
    
      `price=[integer]`
    
      `stock=[integer]`
    
  • Success Response:

    params

      id : `3`
    

    input header

      token : `<secretToken>`
    

    input body

      id : 3
    
      name: Carrier,
    
      image_url: http://localhost:3000/assets/image/product.jpg,
    
      price: 200000,
    
      stock: 30
    
    • Code: 200 OK
      Content: { "id": 3, "name": "Carrier", "image_url": "http://localhost:3000/assets/image/product.jpg", "price": 200000, "stock": 30, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
  • Error Response:

    params

      id : `3`
    

    input header

      token : `<secretToken>`
    

    input body

      name: ,
    
      image_url: http://localhost:3000/assets/image/product.txt,
    
      price: -200000,
    
      stock: '30'
    
    • Code: 400 BadRequest
      Content: { "message": [ "Validation notEmpty on name failed", "Validation imageExtention on image_url failed", "Validation notNegativeValue on price failed", "Validation isNumber on stock failed" ] }

OR

  • Error Response:

    params

      id : `3`
    

    input header

      token : ``
    

    input body

      name: Carrier,
    
      image_url: http://localhost:3000/assets/image/product.jpg,
    
      price: 200000,
    
      stock: 30
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }

OR

  • Error Response:

    params

      id : `90`
    

    input header

      token : `<secretToken>`
    

    input body

      name: Carrier,
    
      image_url: http://localhost:3000/assets/image/product.jpg,
    
      price: 200000,
    
      stock: 30
    
    • Code: 404 NotFound
      Content: { "message": "Data Not Found" }
  • Sample Call:

    axios
    .put(`${process.env.BASE_URL}/products/id`,{
        name:name ,image_url:image_url ,price:200000 ,stock:30
    })
    

Delete Product


Returns json data.

  • URL

    /products/id

  • Method:

    DELETE

  • URL Params

     `id:[integer]`
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

      `name=[string]`
    
      `image_url=[string]`
    
      `price=[integer]`
    
      `stock=[integer]`
    
  • Success Response:

    params

      id : `3`
    

    input header

      token : `<secretToken>`
    

    input body

      none
    
    • Code: 200 OK
      Content: [ 1 , { "id": 3, "name": "Carrier", "image_url": "http://localhost:3000/assets/image/product.jpg", "price": 200000, "stock": 30, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }]
  • Error Response:

    params

      id : `3`
    

    input header

      token : ``
    

    input body

      none
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }

OR

  • Error Response:

    params

      id : `90`
    

    input header

      token : `<secretToken>`
    

    input body

      none
    
    • Code: 404 NotFound
      Content: { "message": "Data Not Found" }
  • Sample Call:

    axios
    .delete(`${process.env.BASE_URL}/products/id`,{
        name:name ,image_url:image_url ,price:200000 ,stock:30
    })

Category Add


Returns json data.

  • URL

    /categories

  • Method:

    POST

  • URL Params

    Required:

  • Header:

    token : `<secretToken>`
    
  • Data Params

    name=[string]

  • Success Response:

    Input

    name = 'adnventure''
    

    Response

    • Code: 201 OK
      Content:

      `{
      "id": 3,
      "name": "Action",
      "updatedAt": "2020-02-14T15:37:46.848Z",
      "createdAt": "2020-02-14T15:37:46.848Z"
      }`
      
  • Error Response:

    Input

    name = ''
    

    Response

    • Code: 400 BadRequest
      Content: { "message": [ "Validation notEmpty on name failed", ] }
  • Sample Call:

    axios
    .post(`${process.env.BASE_URL}/categories`,{
        name:name
    })

Read All categories


Returns json data.

  • URL

    /categories

  • Method:

    GET

  • URL Params

     none
    
  • Data Body none

  • Success Response:

    input header

      token : `<secretToken>`
    

    input body

    • Code: 200 OK
      Content: [ { "id": 3, "name": "Action", "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" },{ "id": 4, "name": "Adventure", "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" } ]
  • Error Response:

    input header

      token : ``
    

    input body

      none
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }
  • Sample Call:

    axios
    .get(`${process.env.BASE_URL}/categories`)

Read One categories


Returns json data.

  • URL

    /categories/id

  • Method:

    GET

  • URL Params

     `id:3
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

      none
    
  • Success Response:

    input header

      token : `<secretToken>`
    

    input body

    • Code: 200 OK
      Content: { "id": 3, "name": "Carrier", "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
  • Error Response:

    input header

      token : ``
    

    input body

      none
    
    • Code: 404 BadRequest
      Content: { "message": "token require" }

OR

  • Error Response:

    input header

      token : `<secretToken>`
    

    input body

      none
    
    • Code: 404 NotFound
      Content: { "message": "Data Not Found" }
  • Sample Call:

    axios
    .get(`${process.env.BASE_URL}/categories/id`)

Update categories


Returns json data.

  • URL

    /categories/id

  • Method:

    PUT

  • URL Params

     `id:[integer]`
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

      `name=[string]`
    
  • Success Response:

    params

      id : `3`
    

    input header

      token : `<secretToken>`
    

    input body

      id : 3
    
      name: Adventure,
    
    • Code: 200 OK
      Content: { "id": 3, "name": "Adventure", "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
  • Error Response:

    params

      id : `3`
    

    input header

      token : `<secretToken>`
    

    input body

      name: ,
    
    • Code: 400 BadRequest
      Content: { "message": [ "Validation notEmpty on name failed", ] }

OR

  • Error Response:

    params

      id : `3`
    

    input header

      token : ``
    

    input body

      name: name,
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }

OR

  • Error Response:

    params

      id : `90`
    

    input header

      token : `<secretToken>`
    

    input body

      name: name,
    
    • Code: 404 NotFound
      Content: { "message": "Data Not Found" }
  • Sample Call:

    axios
    .put(`${process.env.BASE_URL}/categories/id`,{
        name:name
    })
    

Delete categories


Returns json data.

  • URL

    /categories/id

  • Method:

    DELETE

  • URL Params

     `id:[integer]`
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

  • Success Response:

    params

      id : `3`
    

    input header

      token : `<secretToken>`
    

    input body

      none
    
    • Code: 200 OK
      Content: data succes delete
  • Error Response:

    params

      id : `3`
    

    input header

      token : ``
    

    input body

      none
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }

OR

  • Error Response:

    params

      id : `90`
    

    input header

      token : `<secretToken>`
    

    input body

      none
    
    • Code: 404 NotFound
      Content: { "message": "Data Not Found" }
  • Sample Call:

    axios
    .delete(`${process.env.BASE_URL}/categories/id`,{
        name:name
    })

Carts Add


Returns json data.

  • URL

    /carts

  • Method:

    POST

  • URL Params

    Required:

  • Header:

    token : `<secretToken>`
    
  • Data Params

    ProductId=[string]

  • Success Response:

    Input

    ProductId = 'adnventure''
    

    Response

    • Code: 201 OK
      Content:

      `{
      "id": 1,
      "ProductId": "1",
      "UserId": "1",
      "quantity": "1",
      "updatedAt": "2020-03-14T15:37:46.848Z",
      "createdAt": "2020-03-14T15:37:46.848Z"
      }`
      
  • Error Response:

    Input

    ProductId = ''
    

    Response

    • Code: 400 BadRequest
      Content: { "message": [ "Validation notEmpty on ProductId failed", ] }
  • Sample Call:

    axios
    .post(`${process.env.BASE_URL}/carts`,{
        ProductId:ProductId
    })

Read All carts


Returns json data.

  • URL

    /carts

  • Method:

    GET

  • URL Params

     none
    
  • Data Body none

  • Success Response:

    input header

      token : `<secretToken>`
    

    input body

    • Code: 200 OK
      Content: [ { "id": 7, "UserId": 2, "ProductId": 1, "quantity": 1, "createdAt": "2020-03-26T16:12:54.903Z", "updatedAt": "2020-03-26T16:12:54.903Z", "Product": { "id": 1, "name": "product 1", "CategoryId": 1, "image_url": "string", "price": 1, "stock": 16, "description": "string", "createdAt": "2020-03-26T02:29:26.706Z", "updatedAt": "2020-03-26T02:33:50.374Z" } } ]
  • Error Response:

    input header

      token : ``
    

    input body

      none
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }
  • Sample Call:

    axios
    .get(`${process.env.BASE_URL}/carts`)

Read One carts


Returns json data.

  • URL

    /carts/id

  • Method:

    GET

  • URL Params

     `id:7
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

      none
    
  • Success Response:

    input header

      token : `<secretToken>`
    

    input body

    • Code: 200 OK
      Content: { "id": 7, "UserId": 2, "ProductId": 1, "quantity": 1, "createdAt": "2020-03-26T16:12:54.903Z", "updatedAt": "2020-03-26T16:12:54.903Z", "Product": { "id": 1, "name": "product 1", "CategoryId": 1, "image_url": "string", "price": 1, "stock": 16, "description": "string", "createdAt": "2020-03-26T02:29:26.706Z", "updatedAt": "2020-03-26T02:33:50.374Z" } }
  • Error Response:

    input header

      token : ``
    

    input body

      none
    
    • Code: 404 BadRequest
      Content: { "message": "token require" }

OR

  • Error Response:

    input header

      token : `<secretToken>`
    

    input body

      none
    
    • Code: 404 NotFound
      Content: { "message": "Data Not Found" }
  • Sample Call:

    axios
    .get(`${process.env.BASE_URL}/carts/id`)

Update carts


Returns json data.

  • URL

    /carts/id

  • Method:

    PATCH

  • URL Params

     `id:[integer]`
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

      `quantity=[integer]`
    
  • Success Response:

    params

      id : `7`
    

    input header

      token : `<secretToken>`
    

    input body

      id : 3
    
      ProductId: Adventure,
    
    • Code: 200 OK
      Content: { "id": 7, "UserId": 2, "ProductId": 1, "quantity": 3, "createdAt": "2020-03-26T16:12:54.903Z", "updatedAt": "2020-03-26T16:15:43.628Z" }
  • Error Response:

    params

      id : `7`
    

    input header

      token : `<secretToken>`
    

    input body

      quantity: ,
    
    • Code: 400 BadRequest
      Content: { "message": [ "Validation notEmpty on quantity failed", ] }

OR

  • Error Response:

    params

      id : `7`
    

    input header

      token : `<secretToken>`
    

    input body

      quantity: 0,
    
    • Code: 400 BadRequest
      Content: { "message": [ "Validation min on quantity failed", ] }

OR

  • Error Response:

    params

      id : `3`
    

    input header

      token : ``
    

    input body

      quantity: 2,
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }

OR

  • Error Response:

    params

      id : `90`
    

    input header

      token : `<secretToken>`
    

    input body

      ProductId: ProductId,
    
    • Code: 404 NotFound
      Content: { "message": "Data Not Found" }
  • Sample Call:

    axios
    .put(`${process.env.BASE_URL}/carts/id`,{
        ProductId:ProductId
    })
    

Delete carts


Returns json data.

  • URL

    /carts/id

  • Method:

    DELETE

  • URL Params

     `id:[integer]`
    
  • Header:

    token : `<secretToken>`
    
  • Data Body

  • Success Response:

    params

      id : `3`
    

    input header

      token : `<secretToken>`
    

    input body

      none
    
    • Code: 200 OK
      Content: data succes delete
  • Error Response:

    params

      id : `3`
    

    input header

      token : ``
    

    input body

      none
    
    • Code: 400 BadRequest
      Content: { "message": "token require" }

OR

  • Error Response:

    params

      id : `90`
    

    input header

      token : `<secretToken>`
    

    input body

      none
    
    • Code: 404 NotFound
      Content: { "message": "Data Not Found" }
  • Sample Call:

    axios
    .delete(`${process.env.BASE_URL}/carts/id`,{
        ProductId:ProductId
    })

About

E-Commerce

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 74.4%
  • Vue 25.1%
  • HTML 0.5%