Create provider product · default example type=simple · attributes/variants disabled so empty values are not sent
| Key | Type | Example value | Description |
|---|---|---|---|
type | text | simple | Filter type as documented by the endpoint. Required. Type: string. Allowed values: simple, variant. Example: simple |
attributes disabled | text | ["6a64b113dc6f51f903524f5a","6a64b113dc6f51f903524f5b"] | JSON-encoded array of MongoId strings submitted as a multipart/form-data text field. Required when `type=variant`. Forbidden when `type=simple`. Do not send this field for simple products. Do not send an empty value. Do not use “Send empty value” in Swagger or Postman. These IDs are the selected Product Attributes for the variant product (for example الحجم and اللون). Every variant row must use only `attributeId` values included in this array. Example: ```json [ "6a64b113dc6f51f903524f5a", "6a64b113dc6f51f903524f5b" ] ``` Optional. Type: string. |
variants disabled | text | [{"attributes":[{"attributeId":"6a64b113dc6f51f903524f5a","valueId":"6a64b145dc6f51f903524f73"},{"attributeId":"6a64b113dc6f51f903524f5b","valueId":"6a64b15fdc6f51f903524f8d"}],"quantity":5,"price":120,"discountType":"none","discountValue":0}] | JSON-encoded array of variant objects submitted as a multipart/form-data text field.
Required when `type=variant`.
Forbidden when `type=simple`.
Do not send this field for simple products.
Do not send an empty value.
Do not send nested multipart keys such as
`variants[0][attributes][0][attributeId]`.
Send the full JSON array as the value of this single text field.
Each variant is one purchasable combination of selected attribute values
(example: الحجم = XL, اللون = أحمر, quantity = 5, price = 120,
discountType = none, discountValue = 0).
Each variant object must include exactly:
- `attributes`: array of `{ attributeId, valueId }`
- `quantity` (integer ≥ 1)
- `price` (number > 0)
- `discountType` (`none` | `percentage` | `fixed`)
- `discountValue` (number; use `0` when `discountType=none`)
Backend-enforced rules:
- every `attributeId` inside a variant must appear in the top-level `attributes` array
- each variant must include every selected attribute exactly once
- each `valueId` must belong to its `attributeId`
- duplicate variant combinations are rejected
- quantity, price, and discountValue must be numeric
Example:
```json
[
{
"attributes": [
{
"attributeId": "6a64b113dc6f51f903524f5a",
"valueId": "6a64b145dc6f51f903524f73"
},
{
"attributeId": "6a64b113dc6f51f903524f5b",
"valueId": "6a64b15fdc6f51f903524f8d"
}
],
"quantity": 5,
"price": 120,
"discountType": "none",
"discountValue": 0
}
]
```
Optional.
Type: string. |
Multipart notes:
- Use Postman **file** type for binary fields.
- Image uploads typically accept PNG / JPG / JPEG / WEBP when validation applies.
- `attributes` and `variants` are **Text** form-data fields containing JSON strings — not nested keys.
- For `type=simple`: omit `attributes` and `variants` (do not send empty values).
- For `type=variant`: send both as valid JSON strings with attributeId/valueId pairs.
## Query Parameters
No query parameters for this endpoint.
## Path Parameters
No path parameters for this endpoint.
## Successful Response
Standard envelope:
```json
{
"key": "success",
"message": "...",
"status": 200,
"data": {}
}
```
Clients should branch on `key`, not only HTTP stat