Skip to content

Trikcode/E-Commerce-API

Repository files navigation

E-commerce-API

Document URL

Endpoints


Auth

1. RegisterUser

Endpoint:

Method: POST
Type: RAW
URL: http://localhost:5000/auth/register

Body:

{
    "name":"Kim",
    "email":"kim@gmail.com",
    "password":"secret"
}

2. LoginUser

Endpoint:

Method: POST
Type: RAW
URL: http://localhost:5000/auth/login

Body:

{
   "email":"ayesiga@gmail.com",
    "password":"secrett"
}

3. LogoutUser

Endpoint:

Method: GET
Type: RAW
URL: http://localhost:5000/auth/logout

Body:

{
    "email":"ayesiga@gmail.com",
    "password":"secrett"
}

User

1. GetAllUsers

Endpoint:

Method: GET
Type: 
URL: http://localhost:5000/users

2. ShowCurrentUser

Endpoint:

Method: GET
Type: 
URL: http://localhost:5000/users/showMe

3. UpdateUser

Endpoint:

Method: PATCH
Type: RAW
URL: http://localhost:5000/users/updateUser

Body:

{
    "name":"Trikcode",
    "email":"together@gmail.com",
    "password":"secrettt"
}

4. UpdateUserPassword

Endpoint:

Method: PATCH
Type: RAW
URL: http://localhost:5000/users/updateUserPassword

Body:

{
    "email":"together@gmail.com",
    "password":"secretttt"
}

5. GetSingerUser

Endpoint:

Method: GET
Type: 
URL: http://localhost:5000/users/62af85d10e91f8ff3f1d16a4

Products

1. GetAllProducts

Endpoint:

Method: GET
Type: 
URL: http://localhost:5000/products

2. Create Product

Endpoint:

Method: POST
Type: RAW
URL: http://localhost:5000/products

Body:

{
    "name":"testproduct",
    "description":"this is anew prodt",
    "category":"office",
    "company":"ikea"
}

3. Get Single product

Endpoint:

Method: GET
Type: 
URL: http://localhost:5000/products/62b584178f8ae564c2d3bc70

4. Update Product

Endpoint:

Method: PATCH
Type: 
URL: http://localhost:5000/products/62b584178f8ae564c2d3bc70

5. Delete Product

Endpoint:

Method: DELETE
Type: 
URL: http://localhost:5000/products/62b584178f8ae564c2d3bc70

6. UploadImage

Endpoint:

Method: POST
Type: FORMDATA
URL: http://localhost:5000/products/uploadImage

Query params:

Key Value Description
image file

Body:

Key Value Description
image

Review

1. Get All Reviews

Endpoint:

Method: GET
Type: 
URL: http://localhost:5000/reviews

2. Create Review

Endpoint:

Method: POST
Type: RAW
URL: http://localhost:5000/reviews

Body:

{
    "rating":2,
    "title":"Bad product",
    "comment":"too bad",
    "product":"62b585358f8ae564c2d3bc7a"
}

3. Update Review

Endpoint:

Method: PATCH
Type: RAW
URL: http://localhost:5000/reviews/62b585468f8ae564c2d3bc7e

Body:

{
    "rating":1,
    "title":"God product",
    "comment":"too badggd"
  
}

4. Delete Review

Endpoint:

Method: DELETE
Type: 
URL: http://localhost:5000/reviews/62b585468f8ae564c2d3bc7e

Order

1. Get All Orders

Endpoint:

Method: GET
Type: 
URL: http://localhost:5000/orders

2. Create Order

Endpoint:

Method: POST
Type: RAW
URL: http://localhost:5000/orders

Body:

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

3. Update Order

Endpoint:

Method: PATCH
Type: RAW
URL: http://localhost:5000/orders/62b0cbb7ceba70da332dbf61

Body:

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

4. Get All My Orders

Endpoint:

Method: GET
Type: 
URL: http://localhost:5000/orders/showAllMyOrders

Back to top

Generated at 2022-06-24 12:59:53 by docgen

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors