0% found this document useful (0 votes)
2 views4 pages

Complete_Shopping_API_Spec

The document outlines a Shopping API with models for Stores, Users, Products, Orders, and OrderItems, detailing their fields and relationships. It includes API endpoints for authentication, store management, product management, order processing, cart operations, and admin analytics. Each endpoint specifies the HTTP method, path, and a brief description of its functionality.

Uploaded by

024Pritesh Kadam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Complete_Shopping_API_Spec

The document outlines a Shopping API with models for Stores, Users, Products, Orders, and OrderItems, detailing their fields and relationships. It includes API endpoints for authentication, store management, product management, order processing, cart operations, and admin analytics. Each endpoint specifies the HTTP method, path, and a brief description of its functionality.

Uploaded by

024Pritesh Kadam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

🛒 Shopping API

Models:

🏬 Store Model
Field Name Data Type Primary Key Foreign Key Comments
id Integer Yes
name String Unique
ownerObj Object User Admin user
location String Optional

👤 User Model
Field Name Data Type Primary Key Foreign Key Comments
id Integer Yes
username String
email String Unique
password String
role String admin or
customer
stores List Stores owned
(if admin)
orders List Orders placed
(if customer)

📦 Product Model
Field Name Data Type Primary Key Foreign Key Comments
id Integer Yes
name String
description Text Optional
price Decimal
availableStock Integer
storeObj Object Store Belongs to
store

🧾 Order Model
Field Name Data Type Primary Key Foreign Key Comments
id Integer Yes
userObj Object User Customer who
placed the
order
orderDate DateTime Default = now
status String Pending /
Shipped /
Delivered
totalAmount Decimal Calculated
🧺 OrderItem Model
Field Name Data Type Primary Key Foreign Key Comments
id Integer Yes
productObj Object Product
orderObj Object Order
quantity Integer
priceAtPurchase Decimal Copied from
product
🧩 API Endpoints

🔐 Authentication
Method Endpoint Description
POST /api/register/ Register a new user
(admin/customer)
POST /api/login/ Login to obtain access token
POST /api/logout/ Logout and revoke token

🏬 Store Endpoints
Method Endpoint Description
GET /api/stores/ List all stores
POST /api/stores/ Create a new store (admin
only)
GET /api/stores/{store_id}/ Retrieve details of a specific
store
PUT /api/stores/{store_id}/ Update store details (admin
only)
DELETE /api/stores/{store_id}/ Delete a store (admin only)
GET /api/my-stores/ List stores owned by the
authenticated admin

📦 Product Endpoints
Method Endpoint Description
GET /api/products/ List all products
GET /api/products/{product_id}/ Get details of a product
POST /api/products/ Add a new product to
store (admin only)
PUT /api/products/{product_id}/ Update product details
(admin only)
DELETE /api/products/{product_id}/ Delete product (admin
only)
GET /api/store-products/{store_id}/ Get all products in a
store
GET /api/search/?q={term} Search products by
keyword
POST /api/products/{product_id}/restock/ Restock inventory
(admin only)

🧾 Order Endpoints
Method Endpoint Description
GET /api/orders/ List all orders (admin or
user)
GET /api/orders/{order_id}/ View details of an order
POST /api/orders/ Create new order (user
only)
PUT /api/orders/{order_id}/status/ Update order status (admin
only)
GET /api/my-orders/ Get orders placed by
authenticated customer

🧺 Cart Endpoints
Method Endpoint Description
GET /api/cart/ Get current cart items
POST /api/cart/add/ Add product to cart
PUT /api/cart/update/ Update cart item quantity
DELETE /api/cart/remove/ Remove item from cart
POST /api/cart/checkout/ Checkout cart and create
order

📊 Analytics & Admin Tools


Method Endpoint Description
GET /api/admin/dashboard/ Summary of sales,
customers, and orders
GET /api/admin/store-sales/ Sales data for a store
{store_id}/
GET /api/admin/top-products/ Top-selling products
GET /api/admin/customers/ List of all customers
GET /api/admin/orders/ Order count by status
summary/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy