Update
DevelopingPOST
/products/{productId}Constant
Use the constants below according to the field names and rules for each request
Constant | Value |
---|---|
modifiers.type |
OPTION ADDITIONAL OPTION_VARIABLE ADDITIONAL_VARIABLE |
Validation
Field | Type | Rule | Description |
---|---|---|---|
branch_id |
string |
nullable |
Id from Branch model |
product_category_id |
integer |
nullable |
Id from ProductCategory model |
name_en |
string |
nullable |
|
name_ar |
string |
nullable |
|
description_en |
string |
nullable |
|
description_ar |
string |
nullable |
|
preparation_time |
integer |
nullable min:1 |
|
stock |
integer |
nullable min:0 |
|
images |
array |
nullable |
|
images.* |
file |
nullable image max:2mb |
|
modifiers |
array |
nullable |
|
modifiers.*.name_en |
string |
nullable |
|
modifiers.*.name_ar |
string |
nullable |
|
modifiers.*.barcode |
string |
nullable unique |
|
modifiers.*.type |
string |
required |
From modifiers.type constant above |
modifiers.*.calorie |
integer |
nullable min:0 |
|
modifiers.*.price |
numeric |
nullable min:0 |
|
modifiers.*.cost |
numeric |
nullable min:0 |
|
modifiers.*.is_tax_included |
boolean |
required |
|
modifiers.*.ingredients |
array |
nullable |
|
modifiers.*.ingredients.*.ingredient_id |
integer |
required |
Id from Ingredient model |
modifiers.*.ingredients.*.qty |
integer |
required min:1 |
|
modifiers.*.prices |
array |
nullable |
|
modifiers.*.prices.*.payment_method_key |
string |
required |
Key from PaymentMethod model |
modifiers.*.prices.*.price |
numeric |
required min:0 |
|
modifiers.*.weight_amount |
numeric |
nullable min:0 |
|
modifiers.*.weight_unit |
string |
nullable |
The rules on the fields will change depending on conditions, including the following
Field | Rule | Condition |
---|---|---|
stock |
nullable |
If the stock is left empty, it means the stock is unlimited |
modifiers.*.prices |
nullable |
Fill in if the product price different based on payment method |
modifiers.*.weight_{amount/unit} |
nullable |
Fill in if the product price is based on weight |
Request
Path Params
productId
string
required
Example:
415273e5-08cd-4980-af4f-8c150b648724
Body Params application/json
branch_id
string
optional
product_category_id
integer
optional
name_en
string
optional
name_ar
string
optional
description_en
string
optional
description_ar
string
optional
preparation_time
integer
optional
stock
string
optional
images
array [object]
optional
modifiers
array [object {12}]
optional
name_en
string
optional
name_ar
string
optional
barcode
string
optional
type
string
required
calorie
integer
optional
price
number
optional
cost
number
optional
is_tax_included
boolean
required
weight_amount
number
optional
weight_unit
string
optional
ingredients
array [object {2}]
optional
prices
array [object {2}]
optional
Example
{
"product_category_id": 1,
"name_en": "Voluptas autem Updated",
"stock": null,
"preparation_time": 30,
"modifiers": [
{
"name_en": "Extra Large",
"type": "OPTION",
"calorie": null,
"cost": 9,
"price": 11,
"is_tax_included": 1,
"prices": [
{
"payment_method_key": "MADA",
"price": 12
}
],
"ingredients": [
{
"ingredient_id": 179,
"qty": 1
}
]
}
]
}
Request samples
Responses
OK(200)
HTTP Code: 200
Content Type : JSONapplication/json
Data Schema
meta
object
required
code
integer
required
status
string
required
message
string
required
data
object
required
id
string
required
market_id
string
required
branch_id
null
required
product_category_id
integer
required
name_en
string
required
name_ar
string
required
description_en
null
required
description_ar
null
required
preparation_time
integer
required
stock
null
required
order
integer
required
images
null
required
is_active
boolean
required
created_at
integer
required
updated_at
integer
required
deleted_at
null
required
rating_amount
integer
required
rating_avg
string
required
sold_amount
integer
required
sold_revenue
integer
required
qoyod_id
null
required
option_modifiers_min_total
integer
required
option_modifiers_max_total
integer
required
market
object
required
branch
null
required
category
null
required
ingredients
array [object {6}]
required
prices
array [object {9}]
required
modifiers
array [object {19}]
required
option_modifiers
array [object {19}]
required
additional_modifiers
array[string]
required
Example
{
"meta": {
"code": 200,
"status": "success",
"message": "Update Success"
},
"data": {
"id": "415273e5-08cd-4980-af4f-8c150b648724",
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": null,
"product_category_id": 1,
"name_en": "Voluptas autem Updated",
"name_ar": "Voluptas autem",
"description_en": null,
"description_ar": null,
"preparation_time": 30,
"stock": null,
"order": 10,
"images": null,
"is_active": true,
"created_at": 1698603782894,
"updated_at": 1698603782894,
"deleted_at": null,
"rating_amount": 0,
"rating_avg": "0.00",
"sold_amount": 0,
"sold_revenue": 0,
"qoyod_id": null,
"option_modifiers_min_total": 11,
"option_modifiers_max_total": 11,
"market": {
"id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"sector_id": 1,
"name_en": "First Restaurant",
"name_ar": "First Restaurant",
"description_en": "Ut maxime commodi natus id tenetur ullam. Repudiandae aut quia est perspiciatis facilis dolores repellendus ea eum. Iusto occaecati libero ea voluptas dolore qui qui maxime quod. Eum ut vel possimus sunt doloribus saepe repellendus et.",
"description_ar": "العظمى إستيلاء الأوروبية، حين عل. هو وبعد قتيل، العالمي ولم, يونيو مساعدة التاريخ، وصل تم. بـ سكان الجو اليابان تحت, يتم لأداء تكتيكاً قُدُماً ان. نفس موالية الجنوبي ما, أضف تم غضون أسابيع وقوعها،. وبدون ميناء الأمريكية فقد عل, قتيل، معارضة ضرب عن, دول وبعض لفرنسا تزامناً ثم. أي أدوات استبدال جعل. يكن لغات مشروط من.",
"logo_img": null,
"cover_img": null,
"email": "[email protected]",
"phone_prefix": "966",
"phone": "579112767",
"crn": null,
"tax_number": "12345611",
"created_by": null,
"email_verified_at": null,
"phone_verified_at": null,
"created_at": 1680271006362,
"updated_at": 1683019078189,
"deleted_at": null
},
"branch": null,
"category": null,
"ingredients": [
{
"id": 689,
"product_id": "415273e5-08cd-4980-af4f-8c150b648724",
"product_modifier_id": 5678,
"ingredient_id": 179,
"qty": "1.00",
"ingredient": null
}
],
"prices": [
{
"id": 676,
"product_id": "415273e5-08cd-4980-af4f-8c150b648724",
"product_modifier_id": 5678,
"payment_method_key": "MADA",
"price": 10.43,
"tax": 1.57,
"total": 12,
"is_tax_included": true,
"payment_method": {
"key": "MADA",
"name": "Mada",
"is_online": false,
"logo_img": "http://api-dev.flavours.sa/img/payment-methods/MADA.png"
}
}
],
"modifiers": [
{
"id": 5678,
"product_id": "415273e5-08cd-4980-af4f-8c150b648724",
"name_en": "Extra Large",
"name_ar": "Extra Large",
"type": "OPTION",
"calorie": null,
"price": 9.57,
"tax": 1.43,
"total": 11,
"cost": 9,
"profit": 0.57,
"is_tax_included": true,
"deleted_at": null,
"barcode": null,
"barcode_img": null,
"weight_amount": null,
"weight_unit": null,
"ingredients": [
{
"id": 689,
"product_id": "415273e5-08cd-4980-af4f-8c150b648724",
"product_modifier_id": 5678,
"ingredient_id": 179,
"qty": "1.00",
"ingredient": null
}
],
"prices": [
{
"id": 676,
"product_id": "415273e5-08cd-4980-af4f-8c150b648724",
"product_modifier_id": 5678,
"payment_method_key": "MADA",
"price": 10.43,
"tax": 1.57,
"total": 12,
"is_tax_included": true,
"payment_method": {
"key": "MADA",
"name": "Mada",
"is_online": false,
"logo_img": "http://api-dev.flavours.sa/img/payment-methods/MADA.png"
}
}
]
}
],
"option_modifiers": [
{
"id": 5678,
"product_id": "415273e5-08cd-4980-af4f-8c150b648724",
"name_en": "Extra Large",
"name_ar": "Extra Large",
"type": "OPTION",
"calorie": null,
"price": 9.57,
"tax": 1.43,
"total": 11,
"cost": 9,
"profit": 0.57,
"is_tax_included": true,
"deleted_at": null,
"barcode": null,
"barcode_img": null,
"weight_amount": null,
"weight_unit": null,
"ingredients": [
{
"id": 689,
"product_id": "415273e5-08cd-4980-af4f-8c150b648724",
"product_modifier_id": 5678,
"ingredient_id": 179,
"qty": "1.00",
"ingredient": null
}
],
"prices": [
{
"id": 676,
"product_id": "415273e5-08cd-4980-af4f-8c150b648724",
"product_modifier_id": 5678,
"payment_method_key": "MADA",
"price": 10.43,
"tax": 1.57,
"total": 12,
"is_tax_included": true,
"payment_method": {
"key": "MADA",
"name": "Mada",
"is_online": false,
"logo_img": "http://api-dev.flavours.sa/img/payment-methods/MADA.png"
}
}
]
}
],
"additional_modifiers": []
}
}
Last modified: 3 months ago