Products
The product model contains all the information about products posted by users and brand.
Properties
- Name
category- Type
- string
- Description
The category of the product.
- Name
condition- Type
- string
- Description
The condition of the product (required).
- Name
inOrderId- Type
- ObjectId
- Description
Reference to the order associated with the product.
- Name
promotion- Type
- ObjectId
- Description
Reference to the promotion associated with the product.
- Name
title- Type
- string
- Description
The title of the product (required).
- Name
sex- Type
- string
- Description
The target audience for the product. Can be "unisex", "male", "children", or "female". Defaults to "unisex" (required).
- Name
brand- Type
- string
- Description
The brand of the product.
- Name
sellPrice- Type
- number
- Description
The selling price of the product (required).
- Name
previousPrice- Type
- number
- Description
The previous price of the product.
- Name
images- Type
- Array<ObjectId>
- Description
References to the images associated with the product.
- Name
description- Type
- string
- Description
A description of the product.
- Name
ownerId- Type
- ObjectId
- Description
Reference to the user who owns the product (required).
- Name
rating- Type
- ObjectId
- Description
Reference to the rating of the product.
- Name
size- Type
- string
- Description
The size of the product.
- Name
color- Type
- string
- Description
The color of the product.
- Name
size_attributes- Type
- Array<Schema>
- Description
An array of size attributes for the product.
- Name
contactInfo- Type
- Schema
- Description
Contact information for the product.
- Name
quantity- Type
- number
- Description
The quantity of the product available.
- Name
status- Type
- string
- Description
The status of the product. Can be "ACTIVE", "ORDER_PROCESSING", "SOLD", or "ARCHIVED". Defaults to "ACTIVE".
- Name
tradable- Type
- boolean
- Description
Indicates if the product is tradable. Defaults to false.
- Name
views- Type
- number
- Description
The number of views for the product. Defaults to 0.
- Name
shows- Type
- number
- Description
The number of shows for the product. Defaults to 0.
- Name
likes- Type
- number
- Description
The number of likes for the product. Defaults to 0.
- Name
archivesAt- Type
- Date
- Description
The date when the product will be archived.
- Name
isTest- Type
- boolean
- Description
Indicates if the product is a test product. Defaults to false.
List all products
This endpoint allows you to retrieve a paginated list of all products with optional filters for status, sorting, and category.
Optional attributes
- Name
status- Type
- string
- Description
Filter products by status (e.g., "ACTIVE", "SOLD").
- Name
sort- Type
- string
- Description
Sort products by a specific field (e.g., "price", "created_at").
- Name
category- Type
- string
- Description
Filter products by category.
- Name
limit- Type
- integer
- Description
Limit the number of products returned.
Request
curl -G https://api.thefashionpeople.com/v1/products \
-H "Authorization: Bearer {token}" \
-d status=ACTIVE \
-d sort=price \
-d category=clothing \
-d limit=10
Response
{
"has_more": false,
"data": [
{
"id": "xYz8eIbvDR60rouK",
"title": "Stylish Jacket",
"category": "clothing",
"status": "ACTIVE",
"price": 79.99,
"created_at": 1622332000,
"description": "A stylish jacket for all seasons.",
"images": ["https://cdn.thefashionpeople.com/products/jacket.jpg"]
},
{
"id": "yZz8eIbvDR60rouL"
// ...
}
]
}
Create a product
This endpoint allows you to create a new product.
Required attributes
- Name
title- Type
- string
- Description
The title of the product.
- Name
sellPrice- Type
- number
- Description
The selling price of the product.
- Name
ownerId- Type
- ObjectId
- Description
The ID of the user who owns the product.
Request
curl -X POST https://api.thefashionpeople.com/v1/products \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"title": "New Product",
"sellPrice": 49.99,
"ownerId": "user123"
}'
Response
{
"id": "newProductId",
"title": "New Product",
"sellPrice": 49.99,
"ownerId": "user123",
"status": "ACTIVE",
"created_at": 1622332000,
"description": "",
"images": []
}
Initiate payment flow
This endpoint initiates the payment flow for a specific product and returns an order ID and payment URL.
Required attributes
- Name
productId- Type
- ObjectId
- Description
The ID of the product.
Request
curl -X POST https://api.thefashionpeople.com/v1/products/product123/init-payment \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"productId": "product123"
}'
Response
{
"order_id": "order123",
"payment_url": "https://paymentgateway.com/pay?order_id=order123"
}
Archive a product
This endpoint archives a specific product.
Required attributes
- Name
productId- Type
- ObjectId
- Description
The ID of the product to archive.
Request
curl -X POST https://api.thefashionpeople.com/v1/products/product123/archive \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"productId": "product123"
}'
Response
{
"id": "product123",
"status": "ARCHIVED",
"archived_at": 1622332000
}
Deactivate a product
This endpoint deactivates a specific product.
Required attributes
- Name
productId- Type
- ObjectId
- Description
The ID of the product to deactivate.
Request
curl -X POST https://api.thefashionpeople.com/v1/products/product123/deactivate \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"productId": "product123"
}'
Response
{
"id": "product123",
"status": "INACTIVE",
"deactivated_at": 1622332000
}