Complete E-commerce API
Full-featured e-commerce API with auth, products, orders, payments, reviews, shipping
Addresses
User delivery addresses - user-specific
/api/ecommerce/addresses
Auth Required
User Filtering
Retrieve a paginated list of all addresses
GET /api/ecommerce/addresses
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"data": [
{
"user_id": 1,
"user_name": "John Anderson",
"label": "Home",
"street_address": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"lat": 40.7588999999999970214048516936600208282470703125,
"lng": -73.9851000000000027512214728631079196929931640625,
"is_default": true
},
...
],
"meta": {
"current_page": 1,
"total": 50,
"per_page": 15
}
}
/api/ecommerce/addresses/{id}
Auth Required
Retrieve a single addresse by ID
GET /api/ecommerce/addresses/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"user_id": 1,
"user_name": "John Anderson",
"label": "Home",
"street_address": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"lat": 40.7588999999999970214048516936600208282470703125,
"lng": -73.9851000000000027512214728631079196929931640625,
"is_default": true
}
{
"error": "Resource not found",
"message": "The requested addresse does not exist"
}
/api/ecommerce/addresses
Auth Required
Auto User ID
Create a new addresse
POST /api/ecommerce/addresses
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
{
"user_id": 1,
"user_name": "John Anderson",
"label": "Home",
"street_address": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"lat": 40.7588999999999970214048516936600208282470703125,
"lng": -73.9851000000000027512214728631079196929931640625,
"is_default": true
}
{
"user_id": 1,
"user_name": "John Anderson",
"label": "Home",
"street_address": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"lat": 40.7588999999999970214048516936600208282470703125,
"lng": -73.9851000000000027512214728631079196929931640625,
"is_default": true
}
/api/ecommerce/addresses/{id}
Auth Required
Ownership Check
Update an existing addresse
PUT /api/ecommerce/addresses/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
{
"user_id": 1,
"user_name": "John Anderson",
"label": "Home",
"street_address": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"lat": 40.7588999999999970214048516936600208282470703125,
"lng": -73.9851000000000027512214728631079196929931640625,
"is_default": true
}
{
"user_id": 1,
"user_name": "John Anderson",
"label": "Home",
"street_address": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"lat": 40.7588999999999970214048516936600208282470703125,
"lng": -73.9851000000000027512214728631079196929931640625,
"is_default": true
}
/api/ecommerce/addresses/{id}
Auth Required
Ownership Check
Delete a addresse by ID
DELETE /api/ecommerce/addresses/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"message": "Addresse deleted successfully"
}
{
"error": "Deletion failed",
"message": "Unable to delete the resource"
}
Categories
Product categories
/api/ecommerce/categories
Public
Retrieve a paginated list of all categories
GET /api/ecommerce/categories
Accept: application/json
{
"data": [
{
"name": "Electronics",
"slug": "electronics",
"description": "Electronic devices and accessories",
"image": "https://picsum.photos/300/300?random=cat1",
"parent_id": null,
"products_count": 15
},
...
],
"meta": {
"current_page": 1,
"total": 50,
"per_page": 15
}
}
/api/ecommerce/categories/{id}
Public
Retrieve a single categorie by ID
GET /api/ecommerce/categories/1
Accept: application/json
{
"name": "Electronics",
"slug": "electronics",
"description": "Electronic devices and accessories",
"image": "https://picsum.photos/300/300?random=cat1",
"parent_id": null,
"products_count": 15
}
{
"error": "Resource not found",
"message": "The requested categorie does not exist"
}
/api/ecommerce/categories
Auth Required
Create a new categorie
POST /api/ecommerce/categories
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
{
"name": "Electronics",
"slug": "electronics",
"description": "Electronic devices and accessories",
"image": "https://picsum.photos/300/300?random=cat1",
"parent_id": null,
"products_count": 15
}
{
"name": "Electronics",
"slug": "electronics",
"description": "Electronic devices and accessories",
"image": "https://picsum.photos/300/300?random=cat1",
"parent_id": null,
"products_count": 15
}
/api/ecommerce/categories/{id}
Auth Required
Update an existing categorie
PUT /api/ecommerce/categories/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
{
"name": "Electronics",
"slug": "electronics",
"description": "Electronic devices and accessories",
"image": "https://picsum.photos/300/300?random=cat1",
"parent_id": null,
"products_count": 15
}
{
"name": "Electronics",
"slug": "electronics",
"description": "Electronic devices and accessories",
"image": "https://picsum.photos/300/300?random=cat1",
"parent_id": null,
"products_count": 15
}
/api/ecommerce/categories/{id}
Auth Required
Delete a categorie by ID
DELETE /api/ecommerce/categories/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"message": "Categorie deleted successfully"
}
{
"error": "Deletion failed",
"message": "Unable to delete the resource"
}
Invoices
Order invoices - user-specific
/api/ecommerce/invoices
Auth Required
User Filtering
Retrieve a paginated list of all invoices
GET /api/ecommerce/invoices
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"data": [
{
"invoice_number": "INV-2024-00001",
"order_id": 1,
"order_number": "ORD-2024-00001",
"user_id": 1,
"user_name": "John Anderson",
"billing_address": {
"name": "John Anderson",
"street": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001"
},
"items": [
{
"name": "MacBook Pro 16\"",
"quantity": 1,
"price": 2299.989999999999781721271574497222900390625,
"total": 2299.989999999999781721271574497222900390625
},
{
"name": "AirPods Pro (2nd Gen)",
"quantity": 1,
"price": 249.990000000000009094947017729282379150390625,
"total": 249.990000000000009094947017729282379150390625
}
],
"subtotal": 2549.98000000000001818989403545856475830078125,
"tax": 204,
"total": 2769.96999999999979991116560995578765869140625,
"status": "paid",
"issued_at": "2024-01-15T10:30:00Z",
"due_at": "2024-01-30T23:59:59Z",
"paid_at": "2024-01-15T10:35:00Z"
},
...
],
"meta": {
"current_page": 1,
"total": 50,
"per_page": 15
}
}
/api/ecommerce/invoices/{id}
Auth Required
Retrieve a single invoice by ID
GET /api/ecommerce/invoices/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"invoice_number": "INV-2024-00001",
"order_id": 1,
"order_number": "ORD-2024-00001",
"user_id": 1,
"user_name": "John Anderson",
"billing_address": {
"name": "John Anderson",
"street": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001"
},
"items": [
{
"name": "MacBook Pro 16\"",
"quantity": 1,
"price": 2299.989999999999781721271574497222900390625,
"total": 2299.989999999999781721271574497222900390625
},
{
"name": "AirPods Pro (2nd Gen)",
"quantity": 1,
"price": 249.990000000000009094947017729282379150390625,
"total": 249.990000000000009094947017729282379150390625
}
],
"subtotal": 2549.98000000000001818989403545856475830078125,
"tax": 204,
"total": 2769.96999999999979991116560995578765869140625,
"status": "paid",
"issued_at": "2024-01-15T10:30:00Z",
"due_at": "2024-01-30T23:59:59Z",
"paid_at": "2024-01-15T10:35:00Z"
}
{
"error": "Resource not found",
"message": "The requested invoice does not exist"
}
/api/ecommerce/invoices
Public
Create a new invoice
POST /api/ecommerce/invoices
Content-Type: application/json
{
"invoice_number": "INV-2024-00001",
"order_id": 1,
"order_number": "ORD-2024-00001",
"user_id": 1,
"user_name": "John Anderson",
"billing_address": {
"name": "John Anderson",
"street": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001"
},
"items": [
{
"name": "MacBook Pro 16\"",
"quantity": 1,
"price": 2299.989999999999781721271574497222900390625,
"total": 2299.989999999999781721271574497222900390625
},
{
"name": "AirPods Pro (2nd Gen)",
"quantity": 1,
"price": 249.990000000000009094947017729282379150390625,
"total": 249.990000000000009094947017729282379150390625
}
],
"subtotal": 2549.98000000000001818989403545856475830078125,
"tax": 204,
"total": 2769.96999999999979991116560995578765869140625,
"status": "paid",
"issued_at": "2024-01-15T10:30:00Z",
"due_at": "2024-01-30T23:59:59Z",
"paid_at": "2024-01-15T10:35:00Z"
}
{
"invoice_number": "INV-2024-00001",
"order_id": 1,
"order_number": "ORD-2024-00001",
"user_id": 1,
"user_name": "John Anderson",
"billing_address": {
"name": "John Anderson",
"street": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001"
},
"items": [
{
"name": "MacBook Pro 16\"",
"quantity": 1,
"price": 2299.989999999999781721271574497222900390625,
"total": 2299.989999999999781721271574497222900390625
},
{
"name": "AirPods Pro (2nd Gen)",
"quantity": 1,
"price": 249.990000000000009094947017729282379150390625,
"total": 249.990000000000009094947017729282379150390625
}
],
"subtotal": 2549.98000000000001818989403545856475830078125,
"tax": 204,
"total": 2769.96999999999979991116560995578765869140625,
"status": "paid",
"issued_at": "2024-01-15T10:30:00Z",
"due_at": "2024-01-30T23:59:59Z",
"paid_at": "2024-01-15T10:35:00Z"
}
/api/ecommerce/invoices/{id}
Public
Update an existing invoice
PUT /api/ecommerce/invoices/1
Content-Type: application/json
{
"invoice_number": "INV-2024-00001",
"order_id": 1,
"order_number": "ORD-2024-00001",
"user_id": 1,
"user_name": "John Anderson",
"billing_address": {
"name": "John Anderson",
"street": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001"
},
"items": [
{
"name": "MacBook Pro 16\"",
"quantity": 1,
"price": 2299.989999999999781721271574497222900390625,
"total": 2299.989999999999781721271574497222900390625
},
{
"name": "AirPods Pro (2nd Gen)",
"quantity": 1,
"price": 249.990000000000009094947017729282379150390625,
"total": 249.990000000000009094947017729282379150390625
}
],
"subtotal": 2549.98000000000001818989403545856475830078125,
"tax": 204,
"total": 2769.96999999999979991116560995578765869140625,
"status": "paid",
"issued_at": "2024-01-15T10:30:00Z",
"due_at": "2024-01-30T23:59:59Z",
"paid_at": "2024-01-15T10:35:00Z"
}
{
"invoice_number": "INV-2024-00001",
"order_id": 1,
"order_number": "ORD-2024-00001",
"user_id": 1,
"user_name": "John Anderson",
"billing_address": {
"name": "John Anderson",
"street": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001"
},
"items": [
{
"name": "MacBook Pro 16\"",
"quantity": 1,
"price": 2299.989999999999781721271574497222900390625,
"total": 2299.989999999999781721271574497222900390625
},
{
"name": "AirPods Pro (2nd Gen)",
"quantity": 1,
"price": 249.990000000000009094947017729282379150390625,
"total": 249.990000000000009094947017729282379150390625
}
],
"subtotal": 2549.98000000000001818989403545856475830078125,
"tax": 204,
"total": 2769.96999999999979991116560995578765869140625,
"status": "paid",
"issued_at": "2024-01-15T10:30:00Z",
"due_at": "2024-01-30T23:59:59Z",
"paid_at": "2024-01-15T10:35:00Z"
}
/api/ecommerce/invoices/{id}
Public
Delete a invoice by ID
DELETE /api/ecommerce/invoices/1
Accept: application/json
{
"message": "Invoice deleted successfully"
}
{
"error": "Deletion failed",
"message": "Unable to delete the resource"
}
Orders
Customer orders - user-specific
/api/ecommerce/orders
Auth Required
User Filtering
Retrieve a paginated list of all orders
GET /api/ecommerce/orders
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"data": [
{
"order_number": "ORD-2024-00001",
"user_id": 1,
"user_name": "John Anderson",
"status": "delivered",
"subtotal": 2549.98000000000001818989403545856475830078125,
"tax": 204,
"shipping_cost": 15.9900000000000002131628207280300557613372802734375,
"total": 2769.96999999999979991116560995578765869140625,
"payment_method": "Credit Card (**** 4242)",
"shipping_method": "Express Shipping",
"shipping_address": {
"street": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001"
},
"items": [
{
"product_id": 1,
"product_name": "MacBook Pro 16\"",
"quantity": 1,
"price": 2299.989999999999781721271574497222900390625
},
{
"product_id": 5,
"product_name": "AirPods Pro (2nd Gen)",
"quantity": 1,
"price": 249.990000000000009094947017729282379150390625
}
],
"created_at": "2024-01-15T10:30:00Z",
"estimated_delivery": "2024-01-20"
},
...
],
"meta": {
"current_page": 1,
"total": 50,
"per_page": 15
}
}
/api/ecommerce/orders/{id}
Auth Required
Retrieve a single order by ID
GET /api/ecommerce/orders/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"order_number": "ORD-2024-00001",
"user_id": 1,
"user_name": "John Anderson",
"status": "delivered",
"subtotal": 2549.98000000000001818989403545856475830078125,
"tax": 204,
"shipping_cost": 15.9900000000000002131628207280300557613372802734375,
"total": 2769.96999999999979991116560995578765869140625,
"payment_method": "Credit Card (**** 4242)",
"shipping_method": "Express Shipping",
"shipping_address": {
"street": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001"
},
"items": [
{
"product_id": 1,
"product_name": "MacBook Pro 16\"",
"quantity": 1,
"price": 2299.989999999999781721271574497222900390625
},
{
"product_id": 5,
"product_name": "AirPods Pro (2nd Gen)",
"quantity": 1,
"price": 249.990000000000009094947017729282379150390625
}
],
"created_at": "2024-01-15T10:30:00Z",
"estimated_delivery": "2024-01-20"
}
{
"error": "Resource not found",
"message": "The requested order does not exist"
}
/api/ecommerce/orders
Auth Required
Auto User ID
Create a new order
POST /api/ecommerce/orders
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
{
"order_number": "ORD-2024-00001",
"user_id": 1,
"user_name": "John Anderson",
"status": "delivered",
"subtotal": 2549.98000000000001818989403545856475830078125,
"tax": 204,
"shipping_cost": 15.9900000000000002131628207280300557613372802734375,
"total": 2769.96999999999979991116560995578765869140625,
"payment_method": "Credit Card (**** 4242)",
"shipping_method": "Express Shipping",
"shipping_address": {
"street": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001"
},
"items": [
{
"product_id": 1,
"product_name": "MacBook Pro 16\"",
"quantity": 1,
"price": 2299.989999999999781721271574497222900390625
},
{
"product_id": 5,
"product_name": "AirPods Pro (2nd Gen)",
"quantity": 1,
"price": 249.990000000000009094947017729282379150390625
}
],
"estimated_delivery": "2024-01-20"
}
{
"order_number": "ORD-2024-00001",
"user_id": 1,
"user_name": "John Anderson",
"status": "delivered",
"subtotal": 2549.98000000000001818989403545856475830078125,
"tax": 204,
"shipping_cost": 15.9900000000000002131628207280300557613372802734375,
"total": 2769.96999999999979991116560995578765869140625,
"payment_method": "Credit Card (**** 4242)",
"shipping_method": "Express Shipping",
"shipping_address": {
"street": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001"
},
"items": [
{
"product_id": 1,
"product_name": "MacBook Pro 16\"",
"quantity": 1,
"price": 2299.989999999999781721271574497222900390625
},
{
"product_id": 5,
"product_name": "AirPods Pro (2nd Gen)",
"quantity": 1,
"price": 249.990000000000009094947017729282379150390625
}
],
"created_at": "2024-01-15T10:30:00Z",
"estimated_delivery": "2024-01-20"
}
/api/ecommerce/orders/{id}
Auth Required
Ownership Check
Update an existing order
PUT /api/ecommerce/orders/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
{
"order_number": "ORD-2024-00001",
"user_id": 1,
"user_name": "John Anderson",
"status": "delivered",
"subtotal": 2549.98000000000001818989403545856475830078125,
"tax": 204,
"shipping_cost": 15.9900000000000002131628207280300557613372802734375,
"total": 2769.96999999999979991116560995578765869140625,
"payment_method": "Credit Card (**** 4242)",
"shipping_method": "Express Shipping",
"shipping_address": {
"street": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001"
},
"items": [
{
"product_id": 1,
"product_name": "MacBook Pro 16\"",
"quantity": 1,
"price": 2299.989999999999781721271574497222900390625
},
{
"product_id": 5,
"product_name": "AirPods Pro (2nd Gen)",
"quantity": 1,
"price": 249.990000000000009094947017729282379150390625
}
],
"estimated_delivery": "2024-01-20"
}
{
"order_number": "ORD-2024-00001",
"user_id": 1,
"user_name": "John Anderson",
"status": "delivered",
"subtotal": 2549.98000000000001818989403545856475830078125,
"tax": 204,
"shipping_cost": 15.9900000000000002131628207280300557613372802734375,
"total": 2769.96999999999979991116560995578765869140625,
"payment_method": "Credit Card (**** 4242)",
"shipping_method": "Express Shipping",
"shipping_address": {
"street": "123 Main Street, Apt 4B",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001"
},
"items": [
{
"product_id": 1,
"product_name": "MacBook Pro 16\"",
"quantity": 1,
"price": 2299.989999999999781721271574497222900390625
},
{
"product_id": 5,
"product_name": "AirPods Pro (2nd Gen)",
"quantity": 1,
"price": 249.990000000000009094947017729282379150390625
}
],
"created_at": "2024-01-15T10:30:00Z",
"estimated_delivery": "2024-01-20"
}
/api/ecommerce/orders/{id}
Auth Required
Ownership Check
Delete a order by ID
DELETE /api/ecommerce/orders/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"message": "Order deleted successfully"
}
{
"error": "Deletion failed",
"message": "Unable to delete the resource"
}
Payment-methods
Available payment methods
/api/ecommerce/payment-methods
Public
Retrieve a paginated list of all payment-methods
GET /api/ecommerce/payment-methods
Accept: application/json
{
"data": [
{
"name": "Credit Card",
"type": "card",
"icon": "\ud83d\udcb3",
"is_active": true,
"description": "Visa, Mastercard, Amex"
},
...
],
"meta": {
"current_page": 1,
"total": 50,
"per_page": 15
}
}
/api/ecommerce/payment-methods/{id}
Public
Retrieve a single payment-method by ID
GET /api/ecommerce/payment-methods/1
Accept: application/json
{
"name": "Credit Card",
"type": "card",
"icon": "\ud83d\udcb3",
"is_active": true,
"description": "Visa, Mastercard, Amex"
}
{
"error": "Resource not found",
"message": "The requested payment-method does not exist"
}
/api/ecommerce/payment-methods
Public
Create a new payment-method
POST /api/ecommerce/payment-methods
Content-Type: application/json
{
"name": "Credit Card",
"type": "card",
"icon": "\ud83d\udcb3",
"is_active": true,
"description": "Visa, Mastercard, Amex"
}
{
"name": "Credit Card",
"type": "card",
"icon": "\ud83d\udcb3",
"is_active": true,
"description": "Visa, Mastercard, Amex"
}
/api/ecommerce/payment-methods/{id}
Public
Update an existing payment-method
PUT /api/ecommerce/payment-methods/1
Content-Type: application/json
{
"name": "Credit Card",
"type": "card",
"icon": "\ud83d\udcb3",
"is_active": true,
"description": "Visa, Mastercard, Amex"
}
{
"name": "Credit Card",
"type": "card",
"icon": "\ud83d\udcb3",
"is_active": true,
"description": "Visa, Mastercard, Amex"
}
/api/ecommerce/payment-methods/{id}
Public
Delete a payment-method by ID
DELETE /api/ecommerce/payment-methods/1
Accept: application/json
{
"message": "Payment-method deleted successfully"
}
{
"error": "Deletion failed",
"message": "Unable to delete the resource"
}
Products
Product catalog
/api/ecommerce/products
Public
Retrieve a paginated list of all products
GET /api/ecommerce/products
Accept: application/json
{
"data": [
{
"name": "MacBook Pro 16\"",
"slug": "macbook-pro-16",
"description": "Apple M2 Pro chip, 16GB RAM, 512GB SSD",
"price": 2499.989999999999781721271574497222900390625,
"sale_price": 2299.989999999999781721271574497222900390625,
"category_id": 2,
"category_name": "Laptops",
"stock": 25,
"sku": "MBP-16-M2",
"images": [
"https://picsum.photos/600/600?random=prod1",
"https://picsum.photos/600/600?random=prod1a"
],
"rating": 4.79999999999999982236431605997495353221893310546875,
"reviews_count": 124,
"is_featured": true,
"weight": 2.100000000000000088817841970012523233890533447265625,
"dimensions": "35.79 x 24.81 x 1.68 cm"
},
...
],
"meta": {
"current_page": 1,
"total": 50,
"per_page": 15
}
}
/api/ecommerce/products/{id}
Public
Retrieve a single product by ID
GET /api/ecommerce/products/1
Accept: application/json
{
"name": "MacBook Pro 16\"",
"slug": "macbook-pro-16",
"description": "Apple M2 Pro chip, 16GB RAM, 512GB SSD",
"price": 2499.989999999999781721271574497222900390625,
"sale_price": 2299.989999999999781721271574497222900390625,
"category_id": 2,
"category_name": "Laptops",
"stock": 25,
"sku": "MBP-16-M2",
"images": [
"https://picsum.photos/600/600?random=prod1",
"https://picsum.photos/600/600?random=prod1a"
],
"rating": 4.79999999999999982236431605997495353221893310546875,
"reviews_count": 124,
"is_featured": true,
"weight": 2.100000000000000088817841970012523233890533447265625,
"dimensions": "35.79 x 24.81 x 1.68 cm"
}
{
"error": "Resource not found",
"message": "The requested product does not exist"
}
/api/ecommerce/products
Auth Required
Create a new product
POST /api/ecommerce/products
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
{
"name": "MacBook Pro 16\"",
"slug": "macbook-pro-16",
"description": "Apple M2 Pro chip, 16GB RAM, 512GB SSD",
"price": 2499.989999999999781721271574497222900390625,
"sale_price": 2299.989999999999781721271574497222900390625,
"category_id": 2,
"category_name": "Laptops",
"stock": 25,
"sku": "MBP-16-M2",
"images": [
"https://picsum.photos/600/600?random=prod1",
"https://picsum.photos/600/600?random=prod1a"
],
"rating": 4.79999999999999982236431605997495353221893310546875,
"reviews_count": 124,
"is_featured": true,
"weight": 2.100000000000000088817841970012523233890533447265625,
"dimensions": "35.79 x 24.81 x 1.68 cm"
}
{
"name": "MacBook Pro 16\"",
"slug": "macbook-pro-16",
"description": "Apple M2 Pro chip, 16GB RAM, 512GB SSD",
"price": 2499.989999999999781721271574497222900390625,
"sale_price": 2299.989999999999781721271574497222900390625,
"category_id": 2,
"category_name": "Laptops",
"stock": 25,
"sku": "MBP-16-M2",
"images": [
"https://picsum.photos/600/600?random=prod1",
"https://picsum.photos/600/600?random=prod1a"
],
"rating": 4.79999999999999982236431605997495353221893310546875,
"reviews_count": 124,
"is_featured": true,
"weight": 2.100000000000000088817841970012523233890533447265625,
"dimensions": "35.79 x 24.81 x 1.68 cm"
}
/api/ecommerce/products/{id}
Auth Required
Update an existing product
PUT /api/ecommerce/products/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
{
"name": "MacBook Pro 16\"",
"slug": "macbook-pro-16",
"description": "Apple M2 Pro chip, 16GB RAM, 512GB SSD",
"price": 2499.989999999999781721271574497222900390625,
"sale_price": 2299.989999999999781721271574497222900390625,
"category_id": 2,
"category_name": "Laptops",
"stock": 25,
"sku": "MBP-16-M2",
"images": [
"https://picsum.photos/600/600?random=prod1",
"https://picsum.photos/600/600?random=prod1a"
],
"rating": 4.79999999999999982236431605997495353221893310546875,
"reviews_count": 124,
"is_featured": true,
"weight": 2.100000000000000088817841970012523233890533447265625,
"dimensions": "35.79 x 24.81 x 1.68 cm"
}
{
"name": "MacBook Pro 16\"",
"slug": "macbook-pro-16",
"description": "Apple M2 Pro chip, 16GB RAM, 512GB SSD",
"price": 2499.989999999999781721271574497222900390625,
"sale_price": 2299.989999999999781721271574497222900390625,
"category_id": 2,
"category_name": "Laptops",
"stock": 25,
"sku": "MBP-16-M2",
"images": [
"https://picsum.photos/600/600?random=prod1",
"https://picsum.photos/600/600?random=prod1a"
],
"rating": 4.79999999999999982236431605997495353221893310546875,
"reviews_count": 124,
"is_featured": true,
"weight": 2.100000000000000088817841970012523233890533447265625,
"dimensions": "35.79 x 24.81 x 1.68 cm"
}
/api/ecommerce/products/{id}
Auth Required
Delete a product by ID
DELETE /api/ecommerce/products/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"message": "Product deleted successfully"
}
{
"error": "Deletion failed",
"message": "Unable to delete the resource"
}
Reviews
Product reviews and ratings
/api/ecommerce/reviews
Public
Retrieve a paginated list of all reviews
GET /api/ecommerce/reviews
Accept: application/json
{
"data": [
{
"product_id": 1,
"product_name": "MacBook Pro 16\"",
"user_id": 1,
"user_name": "John Anderson",
"user_avatar": "https://i.pravatar.cc/50?img=12",
"rating": 5,
"title": "Best laptop I ever owned!",
"comment": "The M2 Pro chip is incredibly fast. Battery life is amazing. Highly recommend!",
"verified_purchase": true,
"helpful_count": 45,
"created_at": "2024-01-18T15:30:00Z"
},
...
],
"meta": {
"current_page": 1,
"total": 50,
"per_page": 15
}
}
/api/ecommerce/reviews/{id}
Public
Retrieve a single review by ID
GET /api/ecommerce/reviews/1
Accept: application/json
{
"product_id": 1,
"product_name": "MacBook Pro 16\"",
"user_id": 1,
"user_name": "John Anderson",
"user_avatar": "https://i.pravatar.cc/50?img=12",
"rating": 5,
"title": "Best laptop I ever owned!",
"comment": "The M2 Pro chip is incredibly fast. Battery life is amazing. Highly recommend!",
"verified_purchase": true,
"helpful_count": 45,
"created_at": "2024-01-18T15:30:00Z"
}
{
"error": "Resource not found",
"message": "The requested review does not exist"
}
/api/ecommerce/reviews
Auth Required
Auto User ID
Create a new review
POST /api/ecommerce/reviews
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
{
"product_id": 1,
"product_name": "MacBook Pro 16\"",
"user_id": 1,
"user_name": "John Anderson",
"user_avatar": "https://i.pravatar.cc/50?img=12",
"rating": 5,
"title": "Best laptop I ever owned!",
"comment": "The M2 Pro chip is incredibly fast. Battery life is amazing. Highly recommend!",
"verified_purchase": true,
"helpful_count": 45
}
{
"product_id": 1,
"product_name": "MacBook Pro 16\"",
"user_id": 1,
"user_name": "John Anderson",
"user_avatar": "https://i.pravatar.cc/50?img=12",
"rating": 5,
"title": "Best laptop I ever owned!",
"comment": "The M2 Pro chip is incredibly fast. Battery life is amazing. Highly recommend!",
"verified_purchase": true,
"helpful_count": 45,
"created_at": "2024-01-18T15:30:00Z"
}
/api/ecommerce/reviews/{id}
Auth Required
Ownership Check
Update an existing review
PUT /api/ecommerce/reviews/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
{
"product_id": 1,
"product_name": "MacBook Pro 16\"",
"user_id": 1,
"user_name": "John Anderson",
"user_avatar": "https://i.pravatar.cc/50?img=12",
"rating": 5,
"title": "Best laptop I ever owned!",
"comment": "The M2 Pro chip is incredibly fast. Battery life is amazing. Highly recommend!",
"verified_purchase": true,
"helpful_count": 45
}
{
"product_id": 1,
"product_name": "MacBook Pro 16\"",
"user_id": 1,
"user_name": "John Anderson",
"user_avatar": "https://i.pravatar.cc/50?img=12",
"rating": 5,
"title": "Best laptop I ever owned!",
"comment": "The M2 Pro chip is incredibly fast. Battery life is amazing. Highly recommend!",
"verified_purchase": true,
"helpful_count": 45,
"created_at": "2024-01-18T15:30:00Z"
}
/api/ecommerce/reviews/{id}
Auth Required
Ownership Check
Delete a review by ID
DELETE /api/ecommerce/reviews/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"message": "Review deleted successfully"
}
{
"error": "Deletion failed",
"message": "Unable to delete the resource"
}
Shipping-methods
Available shipping options
/api/ecommerce/shipping-methods
Public
Retrieve a paginated list of all shipping-methods
GET /api/ecommerce/shipping-methods
Accept: application/json
{
"data": [
{
"name": "Standard Shipping",
"delivery_time": "5-7 business days",
"cost": 5.9900000000000002131628207280300557613372802734375,
"icon": "\ud83d\udce6",
"description": "Regular delivery service"
},
...
],
"meta": {
"current_page": 1,
"total": 50,
"per_page": 15
}
}
/api/ecommerce/shipping-methods/{id}
Public
Retrieve a single shipping-method by ID
GET /api/ecommerce/shipping-methods/1
Accept: application/json
{
"name": "Standard Shipping",
"delivery_time": "5-7 business days",
"cost": 5.9900000000000002131628207280300557613372802734375,
"icon": "\ud83d\udce6",
"description": "Regular delivery service"
}
{
"error": "Resource not found",
"message": "The requested shipping-method does not exist"
}
/api/ecommerce/shipping-methods
Public
Create a new shipping-method
POST /api/ecommerce/shipping-methods
Content-Type: application/json
{
"name": "Standard Shipping",
"delivery_time": "5-7 business days",
"cost": 5.9900000000000002131628207280300557613372802734375,
"icon": "\ud83d\udce6",
"description": "Regular delivery service"
}
{
"name": "Standard Shipping",
"delivery_time": "5-7 business days",
"cost": 5.9900000000000002131628207280300557613372802734375,
"icon": "\ud83d\udce6",
"description": "Regular delivery service"
}
/api/ecommerce/shipping-methods/{id}
Public
Update an existing shipping-method
PUT /api/ecommerce/shipping-methods/1
Content-Type: application/json
{
"name": "Standard Shipping",
"delivery_time": "5-7 business days",
"cost": 5.9900000000000002131628207280300557613372802734375,
"icon": "\ud83d\udce6",
"description": "Regular delivery service"
}
{
"name": "Standard Shipping",
"delivery_time": "5-7 business days",
"cost": 5.9900000000000002131628207280300557613372802734375,
"icon": "\ud83d\udce6",
"description": "Regular delivery service"
}
/api/ecommerce/shipping-methods/{id}
Public
Delete a shipping-method by ID
DELETE /api/ecommerce/shipping-methods/1
Accept: application/json
{
"message": "Shipping-method deleted successfully"
}
{
"error": "Deletion failed",
"message": "Unable to delete the resource"
}
Users
Customer accounts
/api/ecommerce/users
Auth Required
User Filtering
Retrieve a paginated list of all users
GET /api/ecommerce/users
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"data": [
{
"id": 1,
"name": "John Anderson",
"email": "john@example.com",
"password": "$2y$12$Np.sWfvPM1Z5hz0RTa0q9eQ4gTA4k73cCyAcFqW8lObMp0EvbJq9W",
"api_token": "815c784f9d64d7efce4c932db8416cf6dee2194c73e79e1a5a22683b14a9722f",
"phone": "+1-555-0101",
"avatar": "https://i.pravatar.cc/150?img=12",
"role": "customer",
"joined_at": "2023-01-15",
"orders_count": 12,
"total_spent": 3456.78000000000020008883439004421234130859375
},
...
],
"meta": {
"current_page": 1,
"total": 50,
"per_page": 15
}
}
/api/ecommerce/users/{id}
Auth Required
Retrieve a single user by ID
GET /api/ecommerce/users/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"id": 1,
"name": "John Anderson",
"email": "john@example.com",
"password": "$2y$12$Np.sWfvPM1Z5hz0RTa0q9eQ4gTA4k73cCyAcFqW8lObMp0EvbJq9W",
"api_token": "815c784f9d64d7efce4c932db8416cf6dee2194c73e79e1a5a22683b14a9722f",
"phone": "+1-555-0101",
"avatar": "https://i.pravatar.cc/150?img=12",
"role": "customer",
"joined_at": "2023-01-15",
"orders_count": 12,
"total_spent": 3456.78000000000020008883439004421234130859375
}
{
"error": "Resource not found",
"message": "The requested user does not exist"
}
/api/ecommerce/users
Public
Create a new user
POST /api/ecommerce/users
Content-Type: application/json
{
"name": "John Anderson",
"email": "john@example.com",
"password": "$2y$12$Np.sWfvPM1Z5hz0RTa0q9eQ4gTA4k73cCyAcFqW8lObMp0EvbJq9W",
"api_token": "815c784f9d64d7efce4c932db8416cf6dee2194c73e79e1a5a22683b14a9722f",
"phone": "+1-555-0101",
"avatar": "https://i.pravatar.cc/150?img=12",
"role": "customer",
"joined_at": "2023-01-15",
"orders_count": 12,
"total_spent": 3456.78000000000020008883439004421234130859375
}
{
"id": 1,
"name": "John Anderson",
"email": "john@example.com",
"password": "$2y$12$Np.sWfvPM1Z5hz0RTa0q9eQ4gTA4k73cCyAcFqW8lObMp0EvbJq9W",
"api_token": "815c784f9d64d7efce4c932db8416cf6dee2194c73e79e1a5a22683b14a9722f",
"phone": "+1-555-0101",
"avatar": "https://i.pravatar.cc/150?img=12",
"role": "customer",
"joined_at": "2023-01-15",
"orders_count": 12,
"total_spent": 3456.78000000000020008883439004421234130859375
}
/api/ecommerce/users/{id}
Auth Required
Ownership Check
Update an existing user
PUT /api/ecommerce/users/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
{
"name": "John Anderson",
"email": "john@example.com",
"password": "$2y$12$Np.sWfvPM1Z5hz0RTa0q9eQ4gTA4k73cCyAcFqW8lObMp0EvbJq9W",
"api_token": "815c784f9d64d7efce4c932db8416cf6dee2194c73e79e1a5a22683b14a9722f",
"phone": "+1-555-0101",
"avatar": "https://i.pravatar.cc/150?img=12",
"role": "customer",
"joined_at": "2023-01-15",
"orders_count": 12,
"total_spent": 3456.78000000000020008883439004421234130859375
}
{
"id": 1,
"name": "John Anderson",
"email": "john@example.com",
"password": "$2y$12$Np.sWfvPM1Z5hz0RTa0q9eQ4gTA4k73cCyAcFqW8lObMp0EvbJq9W",
"api_token": "815c784f9d64d7efce4c932db8416cf6dee2194c73e79e1a5a22683b14a9722f",
"phone": "+1-555-0101",
"avatar": "https://i.pravatar.cc/150?img=12",
"role": "customer",
"joined_at": "2023-01-15",
"orders_count": 12,
"total_spent": 3456.78000000000020008883439004421234130859375
}
/api/ecommerce/users/{id}
Auth Required
Ownership Check
Delete a user by ID
DELETE /api/ecommerce/users/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
{
"message": "User deleted successfully"
}
{
"error": "Deletion failed",
"message": "Unable to delete the resource"
}