Skip to content

ecommerce-API is a RESTful API built with Nodejs, express and Mongo DB. Its users can create, read, update and delete products and product reviews from the store.

Notifications You must be signed in to change notification settings

ambrose-kibet/ecommerce-api

Repository files navigation

E-commerce-API

Indices


Auth

1. login

Endpoint:

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

Body:

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

More example Requests/Responses:

I. Example Request: login

Body:

{
    "email": "[email protected]",
    "password": "Chicken"
}
I. Example Response: login
{
    "user": {
        "userId": "631ee96e988c3dbc29aae01e",
        "name": "amkibet",
        "role": "admin"
    }
}

Status Code: 200


2. logout

Endpoint:

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

3. register

Endpoint:

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

Body:

{
    "name":"ambrose","email":"[email protected]","password":"somePass"
}

Users

1. get All users

Endpoint:

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

2. get Single user

Endpoint:

Method: GET
Type: 
URL: https://e-commerce-api-st3k.onrender.com/users/631c3556cf21f540d3566c72

3. show Me

Endpoint:

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

More example Requests/Responses:

I. Example Request: show Me
I. Example Response: show Me
{
    "user": {
        "userId": "631ee96e988c3dbc29aae01e",
        "name": "amkibet",
        "role": "admin"
    }
}

Status Code: 200


4. update User password

Endpoint:

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

Body:

{
    "oldPassword":"oldpass","newPassword":"newPass"
}

5. update user

Endpoint:

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

Body:

{
    "email":"[email protected]","name":"amkibet"
}

orders

1. create order

Endpoint:

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

Body:

{
    "tax": 499,
    "shippingFee": 799,
    "items": [
      {
        "name": "bed",
        "price": 2699,
        "image": "https://dl.airtable.com/.attachmentThumbnails/e8bc3791196535af65f40e36993b9e1f/438bd160",
        "amount": 3,
        "product": "632ab27fb1f620423bb7bc6e"
      },
      {
        "name": "chair",
        "price": 2999,
        "image": "https://dl.airtable.com/.attachmentThumbnails/e8bc3791196535af65f40e36993b9e1f/438bd160",
        "amount": 2,
        "product": "632ab297b1f620423bb7bc70"
      }
    ]
  }

2. get All orders

Endpoint:

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

3. get single order

Endpoint:

Method: GET
Type: 
URL: https://e-commerce-api-st3k.onrender.com/orders/632b005239e7c11436353fc7

4. my orders

Endpoint:

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

5. update order

Endpoint:

Method: PATCH
Type: RAW
URL: https://e-commerce-api-st3k.onrender.com/orders/632b005239e7c11436353fc7

Body:

{
    "paymentIntentId":"ccbvcbvccbxbvxvvx","status":"paid"
}

products

1. create product

Endpoint:

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

Body:

{
    "name": "black chair",
    "price": 12599,
    "image": "https://dl.airtable.com/.attachmentThumbnails/530c07c5ade5acd9934c8dd334458b86/cf91397f",
    "colors": ["#000", "#00ff00", "#0000ff"],
    "company": "ikea",
    "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": "office"
  }

2. delete product

Endpoint:

Method: DELETE
Type: 
URL: https://e-commerce-api-st3k.onrender.com/products/64292d095932bece4fd4416d

3. get All Products

Endpoint:

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

4. get single product

Endpoint:

Method: GET
Type: 
URL: https://e-commerce-api-st3k.onrender.com/products/632ab27fb1f620423bb7bc6e

5. get single product reviews

Endpoint:

Method: GET
Type: 
URL: https://e-commerce-api-st3k.onrender.com/products/632ab27fb1f620423bb7bc6e/reviews

6. update product

Endpoint:

Method: PATCH
Type: RAW
URL: https://e-commerce-api-st3k.onrender.com/products/632ab27fb1f620423bb7bc6e

Body:

{
    "name":"big chair","price":12905,"description":"hfhfhfhfhh fhfhfhhfh hfhdhdhhdhdh dhdhdhdh"
}

7. upload image

Endpoint:

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

Query params:

Key Value Description

Body:

Key Value Description
image

reviews

1. create review

Endpoint:

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

Body:

{"product":"632ab297b1f620423bb7bc70","title":"bad product","comment":"it was horrible .i btoke my back while just trying to sit","rating":1}

2. delete review

Endpoint:

Method: DELETE
Type: 
URL: https://e-commerce-api-st3k.onrender.com/reviews/642930db5932bece4fd4417c

3. get Single review

Endpoint:

Method: GET
Type: 
URL: https://e-commerce-api-st3k.onrender.com/reviews/642930db5932bece4fd4417c

4. get all reviews

Endpoint:

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

5. update review

Endpoint:

Method: PATCH
Type: RAW
URL: https://e-commerce-api-st3k.onrender.com/reviews/642930db5932bece4fd4417c

Body:

{"title":"good product","comment":"it was horrible .i btoke my back while just trying to sit","rating":4}

Back to top

Made with ♥ by thedevsaddam | Generated at: 2023-06-04 23:10:26 by docgen

About

ecommerce-API is a RESTful API built with Nodejs, express and Mongo DB. Its users can create, read, update and delete products and product reviews from the store.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published