Skip to content

This repository contains code files for the Backend for an E-Commerce API

Notifications You must be signed in to change notification settings

olaide-hok/E-Commerce-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce-API

Endpoints


Auth

1. Logout User

Endpoint:

Method: GET
Type:
URL: https://e-commerce-api-nox6.onrender.com/auth/logout

2. Login User

Endpoint:

Method: POST
Type: RAW
URL: https://e-commerce-api-nox6.onrender.com/auth/login

Body:

{
    "email": "[email protected]",
    "password": "secret"
}

3. Register User

Endpoint:

Method: POST
Type: RAW
URL: https://e-commerce-api-nox6.onrender.com/auth/register

Body:

{
    "name": "susan",
    "email": "[email protected]",
    "password": "secret"
}

User

1. Get All Users

Endpoint:

Method: GET
Type:
URL: https://e-commerce-api-nox6.onrender.com/users

2. Get Single User

Endpoint:

Method: GET
Type:
URL: https://e-commerce-api-nox6.onrender.com/users/123

3. Show Current User

Endpoint:

Method: GET
Type:
URL: https://e-commerce-api-nox6.onrender.com/users/showMe

4. Update User

Endpoint:

Method: PATCH
Type: RAW
URL: https://e-commerce-api-nox6.onrender.com/users/updateUser

Body:

{
    "name": "coco"
}

5. Update User Password

Endpoint:

Method: PATCH
Type: RAW
URL: https://e-commerce-api-nox6.onrender.com/users/updateUserPassword

Body:

{
    "newPassword": "newsecret",
    "oldPassword": "secret"
}

Product

1. Get All Products

Endpoint:

Method: GET
Type:
URL: https://e-commerce-api-nox6.onrender.com/products

2. Create Product

Endpoint:

Method: POST
Type: RAW
URL: https://e-commerce-api-nox6.onrender.com/products

Body:

 {
    "name": "armchair",
    "price": 12599,
    "image": "https://dl.airtable.com/.attachmentThumbnails/530c07c5ade5acd9934c8dd334458b86/cf91397f",
    "colors": ["#000", "#00ff00", "#0000ff"],
    "company": "marcos",
    "description": "Cloud bread VHS hell of banjo bicycle rights jianbing umami mumblecore etsy 8-bit pok pok +1 wolf. Vexillologist yr dreamcatcher waistcoat, authentic chillwave trust fund. Viral typewriter fingerstache pinterest pork belly narwhal. Schlitz venmo everyday carry kitsch pitchfork chillwave iPhone taiyaki trust fund hashtag kinfolk microdosing gochujang live-edge",
    "category": "bedroom"
  }

3. Get Single Product

Endpoint:

Method: GET
Type:
URL: https://e-commerce-api-nox6.onrender.com/products/66d0c5b8869821da7d9ebb74

4. Update Product

Endpoint:

Method: PATCH
Type: RAW
URL: https://e-commerce-api-nox6.onrender.com/products/66d0c5b8869821da7d9ebb74

Body:

{
    "name": "armchair new change"
}

5. Delete Product

Endpoint:

Method: DELETE
Type: RAW
URL: https://e-commerce-api-nox6.onrender.com/products/66d0c5a1869821da7d9ebb72

6. Upload Image

Endpoint:

Method: POST
Type: FORMDATA
URL: https://e-commerce-api-nox6.onrender.com/products/uploadImage

Review

1. Get All Reviews

Endpoint:

Method: GET
Type:
URL: https://e-commerce-api-nox6.onrender.com/reviews

2. Create Review

Endpoint:

Method: POST
Type: RAW
URL: https://e-commerce-api-nox6.onrender.com/reviews

Body:

{
    "product": "66d20d5110d9f55e655dc6eb",
    "rating": 4,
    "title": "very strong product by susan",
    "comment": "very, very good product"
}

3. Get Single Review

Endpoint:

Method: GET
Type:
URL: https://e-commerce-api-nox6.onrender.com/reviews/1234

4. Update Review

Endpoint:

Method: PATCH
Type: RAW
URL: https://e-commerce-api-nox6.onrender.com/reviews/66d20b796e27cbe4458b2c27

Body:

{
    "rating": 3,
    "title": "very strong product",
    "comment": "very, very good product"
}

5. Delete Review

Endpoint:

Method: DELETE
Type:
URL: https://e-commerce-api-nox6.onrender.com/reviews/1234

Order

1. Get All Order

Endpoint:

Method: GET
Type:
URL: https://e-commerce-api-nox6.onrender.com/orders

2. Get Single Order

Endpoint:

Method: GET
Type:
URL: https://e-commerce-api-nox6.onrender.com/orders/66d222685f655544c0bfbe43

3. Create Order

Endpoint:

Method: POST
Type: RAW
URL: https://e-commerce-api-nox6.onrender.com/orders

Body:

{
    "tax": 499,
    "shippingFee": 799,
    "items": [
      {
        "name": "bed",
        "price": 23999,
        "image": "https://dl.airtable.com/.attachmentThumbnails/e8bc3791196535af65f40e36993b9e1f/438bd160",
        "amount": 3,
        "product": "66d222ca5f655544c0bfbe46"
      },
      {
        "name": "chair",
        "price": 12599,
        "image": "https://dl.airtable.com/.attachmentThumbnails/e8bc3791196535af65f40e36993b9e1f/438bd160",
        "amount": 2,
        "product": "66d223305f655544c0bfbe48"
      }
    ]
  }

4. Update Order

Endpoint:

Method: PATCH
Type: RAW
URL: https://e-commerce-api-nox6.onrender.com/orders/66d222685f655544c0bfbe43

Body:

{
    "paymentIntentId": "someRandomId"
}

5. Show Current User Orders

Endpoint:

Method: GET
Type:
URL: https://e-commerce-api-nox6.onrender.com/orders/showAllMyOrders

About

This repository contains code files for the Backend for an E-Commerce API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published