Marketplace RESTful API Documentation
Overview
The Marketplace API provides endpoints to interact with a virtual shopping mall where users can browse, buy, and sell products from various vendors. This API documentation outlines the available endpoints, request/response formats, authentication requirements, and other relevant details.
Base URL
The base URL for accessing the Marketplace API is:
Authentication
Authentication is required for certain endpoints to access user-specific data and perform privileged actions. The Marketplace API uses token-based authentication. Users must include their authentication token in the Authorization
header of each request.
Authentication Routes
Login
POST /auth/login/
POST /auth/login/
Authenticate a user and receive an access token.
Request:
Response:
Logout
POST /auth/logout/
POST /auth/logout/
Log out the authenticated user.
User Details
GET /auth/user/
GET /auth/user/
Retrieve details of the authenticated user.
Password Change
POST /auth/password/change/
POST /auth/password/change/
Change the password for the authenticated user.
Request:
Response:
Token Verify
POST /auth/token/verify/
POST /auth/token/verify/
Verify the validity of an access token.
Request:
Response:
Token Refresh
POST /auth/token/refresh/
POST /auth/token/refresh/
Obtain a new access token using a refresh token.
Request:
Response:
Endpoints
Categories
GET /categories/
GET /categories/
Retrieve a list of all product categories.
Example response:
POST /categories/
POST /categories/
Create a new product category.
GET /categories/{id}/
GET /categories/{id}/
Retrieve details of a specific product category.
PUT /categories/{id}/
PUT /categories/{id}/
Update details of a specific product category.
DELETE /categories/{id}/
DELETE /categories/{id}/
Delete a specific product category.
Tags
GET /tags/
GET /tags/
Retrieve a list of all product tags.
POST /tags/
POST /tags/
Create a new product tag.
GET /tags/{id}/
GET /tags/{id}/
Retrieve details of a specific product tag.
PUT /tags/{id}/
PUT /tags/{id}/
Update details of a specific product tag.
DELETE /tags/{id}/
DELETE /tags/{id}/
Delete a specific product tag.
Subcategories
GET /subcategories/
GET /subcategories/
Retrieve a list of all product subcategories.
POST /subcategories/
POST /subcategories/
Create a new product subcategory.
GET /subcategories/{id}/
GET /subcategories/{id}/
Retrieve details of a specific product subcategory.
PUT /subcategories/{id}/
PUT /subcategories/{id}/
Update details of a specific product subcategory.
DELETE /subcategories/{id}/
DELETE /subcategories/{id}/
Delete a specific product subcategory.
Vendors
GET /vendors/
GET /vendors/
Retrieve a list of all vendors.
POST /vendors/
POST /vendors/
Create a new vendor.
GET /vendors/{id}/
GET /vendors/{id}/
Retrieve details of a specific vendor.
PUT /vendors/{id}/
PUT /vendors/{id}/
Update details of a specific vendor.
DELETE /vendors/{id}/
DELETE /vendors/{id}/
Delete a specific vendor.
Products
GET /products/
GET /products/
Retrieve a list of all products.
POST /products/
POST /products/
Create a new product.
GET /products/{id}/
GET /products/{id}/
Retrieve details of a specific product.
PUT /products/{id}/
PUT /products/{id}/
Update details of a specific product.
DELETE /products/{id}/
DELETE /products/{id}/
Delete a specific product.
Inventory
GET /inventory/
GET /inventory/
Retrieve a list of all inventory items.
POST /inventory/
POST /inventory/
Add a new inventory item.
GET /inventory/{id}/
GET /inventory/{id}/
Retrieve details of a specific inventory item.
PUT /inventory/{id}/
PUT /inventory/{id}/
Update details of a specific inventory item.
DELETE /inventory/{id}/
DELETE /inventory/{id}/
Delete a specific inventory item.
Sales
GET /sales/
GET /sales/
Retrieve a list of all sales.
POST /sales/
POST /sales/
Record a new sale.
GET /sales/{id}/
GET /sales/{id}/
Retrieve details of a specific sale.
PUT /sales/{id}/
PUT /sales/{id}/
Update details of a specific sale.
DELETE /sales/{id}/
DELETE /sales/{id}/
Delete a specific sale.
Marketplace
GET /marketplace/
GET /marketplace/
Retrieve details of the marketplace.
PUT /marketplace/
PUT /marketplace/
Update details of the marketplace.
Customers
GET /customers/
GET /customers/
Retrieve a list of all customers.
POST /customers/
POST /customers/
Create a new customer.
GET /customers/{id}/
GET /customers/{id}/
Retrieve details of a specific customer.
PUT /customers/{id}/
PUT /customers/{id}/
Update details of a specific customer.
DELETE /customers/{id}/
DELETE /customers/{id}/
Delete a specific customer.
Orders
GET /orders/
GET /orders/
Retrieve a list of all orders.
POST /orders/
POST /orders/
Place a new order.
GET /orders/{id}/
GET /orders/{id}/
Retrieve details of a specific order.
PUT /orders/{id}/
PUT /orders/{id}/
Update details of a specific order.
DELETE /orders/{id}/
DELETE /orders/{id}/
Delete a specific order.
Reviews
GET /reviews/
GET /reviews/
Retrieve a list of all product reviews.
POST /reviews/
POST /reviews/
Submit a new product review.
GET /reviews/{id}/
GET /reviews/{id}/
Retrieve details of a specific product review.
PUT /reviews/{id}/
PUT /reviews/{id}/
Update details of a specific product review.
DELETE /reviews/{id}/
DELETE /reviews/{id}/
Delete a specific product review.
Wishlists
GET /wishlists/
GET /wishlists/
Retrieve a list of all wishlists.
POST /wishlists/
POST /wishlists/
Create a new wishlist.
GET /wishlists/{id}/
GET /wishlists/{id}/
Retrieve details of a specific wishlist.
PUT /wishlists/{id}/
PUT /wishlists/{id}/
Update details of a specific wishlist.
DELETE /wishlists/{id}/
DELETE /wishlists/{id}/
Delete a specific wishlist.
Payment Transactions
GET /transactions/
GET /transactions/
Retrieve a list of all payment transactions.
POST /transactions/
POST /transactions/
Record a new payment transaction.
GET /transactions/{id}/
GET /transactions/{id}/
Retrieve details of a specific payment transaction.
PUT /transactions/{id}/
PUT /transactions/{id}/
Update details of a specific payment transaction.
DELETE /transactions/{id}/
DELETE /transactions/{id}/
Delete a specific payment transaction.
Shipping
GET /shipping/
GET /shipping/
Retrieve a list of all shipping records.
POST /shipping/
POST /shipping/
Record a new shipping transaction.
GET /shipping/{id}/
GET /shipping/{id}/
Retrieve details of a specific shipping record.
PUT /shipping/{id}/
PUT /shipping/{id}/
Update details of a specific shipping record.
DELETE /shipping/{id}/
DELETE /shipping/{id}/
Delete a specific shipping record.
Ordering, Pagination, and Page Size
Ordering
By default, resources are ordered alphabetically or by creation date, depending on the resource. The following endpoints support ordering:
Category: Ordered by
name
.Tag: Ordered by
name
.Subcategory: Ordered by
name
.Vendor: Ordered by
company_name
.Product: Ordered by
name
.Inventory: Ordered by
id
.Sale: Ordered by
sale_date
.Marketplace: Ordered by
name
.Customer: Ordered by
user__username
.Order: Ordered by
order_date
.OrderItem: Ordered by
id
.Review: Ordered by
date_added
.Wishlist: Ordered by
id
.PaymentTransaction: Ordered by
transaction_date
.Shipping: Ordered by
shipping_date
.
Pagination
All endpoints that return lists of resources support pagination. By default, 10 items per page are returned.
Page Size
Clients can specify the page size by including the page_size
query parameter in the request URL. The maximum page size is 100 items.
Example:
Adjust the page_size
parameter to control the number of items returned per page.
Conclusion
The Marketplace API provides a comprehensive set of endpoints to manage products, vendors, customers, orders, payments, and more. By following the guidelines outlined in this documentation, frontend developers can effectively integrate and utilize the Marketplace API to build powerful e-commerce applications.
Last updated