DOCUMENTATION

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 32

DOCUMENTATION :

 La création de 2 nouveaux dossier nommés « v4 » situés dans : « C:\xampp\htdocs\routes\


rest_api» et « C:\xampp\htdocs\app\Http\Controllers\RestAPI\»
 La création d’un nouveau API v4 pour gérer les produits et les commandes,
nommé api.php situé dans : « C:\xampp\htdocs\routes\rest_api\v4 »

 Cette api utilise deux contrôleurs, ProductApiController.php et OrderApiController.php situés


dans : « C:\xampp\htdocs\app\Http\Controllers\RestAPI\v4 »

 L’ajout et l’appel d’une fonction mapAPiv4Routes() dans : « C:\xampp\htdocs\app \Providers\


RouteServiceProvider.php »

1- Les Produits :

 Affichage de tous les produits :


- Route : http://localhost/api/v4/products
- Method : GET
- Response :
[
{
"id": 16,
"added_by": "admin",
"user_id": 1,
"name": "Basket-R46",
"slug": "basket-r46-7T3Wr4",
"product_type": "physical",
"category_ids": "[{\"id\":\"1\",\"position\":1},{\"id\":\"2\",\"position\":2},
{\"id\":\"3\",\"position\":3}]",
"category_id": 1,
"sub_category_id": 2,
"sub_sub_category_id": 3,
"brand_id": 1,
"unit": "kg",
"min_qty": 1,
"refundable": 1,
"digital_product_type": null,
"digital_file_ready": "",
"digital_file_ready_storage_type": null,
"images": "[{\"image_name\":\"2024-08-28-
66cf3101e5a3d.webp\",\"storage\":\"public\"}]",
"color_image": "[]",
"thumbnail": "2024-08-28-66cf3101ee58c.webp",
"thumbnail_storage_type": "public",
"featured": null,
"flash_deal": null,
"video_provider": "youtube",
"video_url": null,
"colors": "[]",
"variant_product": 0,
"attributes": null,
"choice_options": "[]",
"variation": "[]",
"digital_product_file_types": [],
"digital_product_extensions": [],
"published": 0,
"unit_price": 20,
"purchase_price": 0,
"tax": 0,
"tax_type": "percent",
"tax_model": "include",
"discount": 0,
"discount_type": "flat",
"current_stock": 232,
"minimum_order_qty": 1,
"details": "<p>Intik&nbsp;</p>",
"free_shipping": 0,
"attachment": null,
"created_at": "2024-08-28T14:15:29.000000Z",
"updated_at": "2024-08-28T14:15:29.000000Z",
"status": 1,
"featured_status": 1,
"meta_title": "Basket-R46",
"meta_description": "Intik",
"meta_image": null,
"request_status": 1,
"denied_note": null,
"shipping_cost": 0,
"multiply_qty": 0,
"temp_shipping_cost": null,
"is_shipping_cost_updated": null,
"code": "8VOUER",
"is_shop_temporary_close": 0,
"thumbnail_full_url": {
"key": "2024-08-28-66cf3101ee58c.webp",
"path": "http://localhost/storage/app/public/product/thumbnail/2024-08-28-
66cf3101ee58c.webp",
"status": 200
},
"color_images_full_url": [],
"meta_image_full_url": {
"key": null,
"path": null,
"status": 404
},
"images_full_url": [
{
"key": "2024-08-28-66cf3101e5a3d.webp",
"path": "http://localhost/storage/app/public/product/2024-08-28-
66cf3101e5a3d.webp",
"status": 200
}
],
"digital_file_ready_full_url": {
"key": "",
"path": null,
"status": 404
},
"translations": [],
"reviews": []
},
{
"id": 18,
"added_by": "admin",
"user_id": 1,
"name": "New hh",
"slug": "new-product-slug",
"product_type": "physical",
"category_ids": "[{\"id\":\"1\",\"position\":1},{\"id\":\"2\",\"position\":2},
{\"id\":\"3\",\"position\":3}]",
"category_id": 1,
"sub_category_id": 2,
"sub_sub_category_id": 3,
"brand_id": 1,
"unit": "pc",
"min_qty": 1,
"refundable": 1,
"digital_product_type": null,
"digital_file_ready": null,
"digital_file_ready_storage_type": "public",
"images": "[{\"image_name\":\"2024-08-28-
66cf3101e5a3d.webp\",\"storage\":\"public\"}]",
"color_image": "[]",
"thumbnail": "2024-08-25-66cb15d4860c2.webp",
"thumbnail_storage_type": "public",
"featured": null,
"flash_deal": null,
"video_provider": null,
"video_url": null,
"colors": "[]",
"variant_product": 0,
"attributes": null,
"choice_options": "[]",
"variation": "[]",
"digital_product_file_types": "[]",
"digital_product_extensions": "[]",
"published": 0,
"unit_price": 15,
"purchase_price": 10,
"tax": 0,
"tax_type": null,
"tax_model": "exclude",
"discount": 0,
"discount_type": null,
"current_stock": 100,
"minimum_order_qty": 1,
"details": "<p>intik hhh</p>",
"free_shipping": 0,
"attachment": null,
"created_at": "2024-08-28T14:25:07.000000Z",
"updated_at": "2024-08-28T15:09:03.000000Z",
"status": 1,
"featured_status": 0,
"meta_title": null,
"meta_description": null,
"meta_image": null,
"request_status": 1,
"denied_note": null,
"shipping_cost": null,
"multiply_qty": null,
"temp_shipping_cost": null,
"is_shipping_cost_updated": null,
"code": "NEWPRDCT013",
"is_shop_temporary_close": 0,
"thumbnail_full_url": {
"key": "2024-08-25-66cb15d4860c2.webp",
"path": "http://localhost/storage/app/public/product/thumbnail/2024-08-25-
66cb15d4860c2.webp",
"status": 200
},
"color_images_full_url": [],
"meta_image_full_url": {
"key": null,
"path": null,
"status": 404
},
"images_full_url": [
{
"key": "2024-08-28-66cf3101e5a3d.webp",
"path": "http://localhost/storage/app/public/product/2024-08-28-
66cf3101e5a3d.webp",
"status": 200
}
],
"digital_file_ready_full_url": {
"key": null,
"p
ath": null,
"status": 404
},
"translations": [],
"reviews": []
}
]

 Affichage d’un produit par id :


- Route : http://localhost/api/v4/products/{id}
- Method : GET
- Response :
{
"id": 16,
"added_by": "admin",
"user_id": 1,
"name": "Basket-R46",
"slug": "basket-r46-7T3Wr4",
"product_type": "physical",
"category_ids": "[{\"id\":\"1\",\"position\":1},{\"id\":\"2\",\"position\":2},
{\"id\":\"3\",\"position\":3}]",
"category_id": 1,
"sub_category_id": 2,
"sub_sub_category_id": 3,
"brand_id": 1,
"unit": "kg",
"min_qty": 1,
"refundable": 1,
"digital_product_type": null,
"digital_file_ready": "",
"digital_file_ready_storage_type": null,
"images": "[{\"image_name\":\"2024-08-28-
66cf3101e5a3d.webp\",\"storage\":\"public\"}]",
"color_image": "[]",
"thumbnail": "2024-08-28-66cf3101ee58c.webp",
"thumbnail_storage_type": "public",
"featured": null,
"flash_deal": null,
"video_provider": "youtube",
"video_url": null,
"colors": "[]",
"variant_product": 0,
"attributes": null,
"choice_options": "[]",
"variation": "[]",
"digital_product_file_types": [],
"digital_product_extensions": [],
"published": 0,
"unit_price": 20,
"purchase_price": 0,
"tax": 0,
"tax_type": "percent",
"tax_model": "include",
"discount": 0,
"discount_type": "flat",
"current_stock": 232,
"minimum_order_qty": 1,
"details": "<p>Intik&nbsp;</p>",
"free_shipping": 0,
"attachment": null,
"created_at": "2024-08-28T14:15:29.000000Z",
"updated_at": "2024-08-28T14:15:29.000000Z",
"status": 1,
"featured_status": 1,
"meta_title": "Basket-R46",
"meta_description": "Intik",
"meta_image": null,
"request_status": 1,
"denied_note": null,
"shipping_cost": 0,
"multiply_qty": 0,
"temp_shipping_cost": null,
"is_shipping_cost_updated": null,
"code": "8VOUER",
"is_shop_temporary_close": 0,
"thumbnail_full_url": {
"key": "2024-08-28-66cf3101ee58c.webp",
"path": "http://localhost/storage/app/public/product/thumbnail/2024-08-28-
66cf3101ee58c.webp",
"status": 200
},
"color_images_full_url": [],
"meta_image_full_url": {
"key": null,
"path": null,
"status": 404
},
"images_full_url": [
{
"key": "2024-08-28-66cf3101e5a3d.webp",
"path": "http://localhost/storage/app/public/product/2024-08-28-
66cf3101e5a3d.webp",
"status": 200
}
],
"digital_file_ready_full_url": {
"key": "",
"path": null,
"status": 404
},
"translations": [],
"reviews": []
}

 Affichage d’un produit par filtre (colonnes préférées) :


- Route : http://localhost/api/v4/products/{id}/columns
- Method : GET
- Params : ?c=col1,col2,...
c : utilisé pour spécifier les colonnes préférées de la table products.
( exemple : http://localhost/api/v4/products/38/columns?c=id,code,name,images)

- Response :
{
"code": "7V50NY",
"name": "product 54",
"images": "[\"2024-09-01-66d4274aec293.webp\",\"2024-09-01-
66d4274af130b.webp\",{\"image_name\":\"2024-09-01-
66d4274b1a5e5.webp\",\"storage\":\"public\"}]"
}
 Ajout d’un produit :
- Route : http://localhost/api/v4/products/add
- Method : POST
- Headers : Content-Type : multipart/form-data
- Body :
( form-data : car il s’agit de l’upload d’une image )
- Response :
{
"user_id": 1,
"added_by": "admin",
"slug": "DZKLEN1",
"product_type": "physical",
"category_id": 1,
"sub_category_id": 2,
"sub_sub_category_id": 3,
"brand_id": 1,
"thumbnail": "1725409116-xotnpRQAoJ.jpg",
"unit_price": 20,
"purchase_price": 15,
"minimum_order_qty": 1,
"name": "product127",
"unit": "kg",
"details": "<p>\"This is a test product\"</p>",
"current_stock": 150,
"category_ids": "[{\"id\":\"1\",\"position\":\"1\"}]",
"colors": "[\"#FF5733\"]",
"variation": "[{\"price\":\"19.99\",\"sku\":\"CTR-S\",\"qty\":\"50\"}]",
"images": "[{\"image_name\":\"1725409116-
HRpbCvjwqU.jpg\",\"storage\":\"public\"},{\"image_name\":\"1725409116-
V06xZg8NtV.webp\",\"storage\":\"public\"}]",
"color_image": "[{\"color\":\"FF5733\",\"image_name\":\"1725409116-
HRpbCvjwqU.jpg\",\"storage\":\"public\"},
{\"color\":null,\"image_name\":\"1725409116-
V06xZg8NtV.webp\",\"storage\":\"public\"}]",
"choice_options": "[]",
"request_status": 1,
"thumbnail_storage_type": "public",
"updated_at": "2024-09-04T00:18:36.000000Z",
"created_at": "2024-09-04T00:18:36.000000Z",
"id": 70,
"is_shop_temporary_close": 0,
"thumbnail_full_url": {
"key": "1725409116-xotnpRQAoJ.jpg",
"path": "http://localhost/storage/app/public/product/thumbnail/1725409116-
xotnpRQAoJ.jpg",
"status": 200
},
"color_images_full_url": [
{
"color": "FF5733",
"image_name": {
"key": "1725409116-HRpbCvjwqU.jpg",
"path": "http://localhost/storage/app/public/product/1725409116-
HRpbCvjwqU.jpg",
"status": 200
}
},
{
"color": null,
"image_name": {
"key": "1725409116-V06xZg8NtV.webp",
"path": "http://localhost/storage/app/public/product/1725409116-
V06xZg8NtV.webp",
"status": 200
}
}
],
"meta_image_full_url": {
"key": null,
"path": null,
"status": 404
},
"images_full_url": [
{
"key": "1725409116-HRpbCvjwqU.jpg",
"path": "http://localhost/storage/app/public/product/1725409116-
HRpbCvjwqU.jpg",
"status": 200
},
{
"key": "1725409116-V06xZg8NtV.webp",
"path": "http://localhost/storage/app/public/product/1725409116-
V06xZg8NtV.webp",
"status": 200
}
],
"digital_file_ready_full_url": {
"key": null,
"path": null,
"status": 404
},
"translations": []
}

 Modification d’un produit :


- Route : http://localhost/api/v4//products/change/{id}
- Method : POST
- Params : ?_method=PUT
- Body : (exemple : changer le nom et la deuxième photo d’un produit)

- Response :

- Avant modification :
 Après modification :

 Suppression d’un produit :


- Route : http://localhost/api/v4/products/delete/{id}
- Method : DELETE
- Response :
{
"message": "Product deleted successfully"
}

2-Les Commandes :

 Affichage de toutes les commandes :


- Route : http://localhost/api/v4/orders/list
- Method : GET
- Response :
[
{
"id": 100001,
"customer_id": 2,
"is_guest": false,
"customer_type": "customer",
"payment_status": "unpaid",
"order_status": "pending",
"payment_method": "cash_on_delivery",
"transaction_ref": "",
"payment_by": null,
"payment_note": null,
"order_amount": 25,
"admin_commission": "0.00",
"is_pause": false,
"cause": null,
"shipping_address": {
"id": 3,
"customer_id": "2",
"is_guest": false,
"contact_person_name": "Jhon",
"email": null,
"address_type": "permanent",
"address": "kgkfdhfjglkhvjk",
"city": "Asdz",
"zip": "176231",
"phone": "+213837482923",
"created_at": null,
"updated_at": "2024-08-28T11:20:30.000000Z",
"state": null,
"country": "Algeria",
"latitude": "0",
"longitude": "0",
"is_billing": false
},
"created_at": "2024-08-24T11:55:05.000000Z",
"updated_at": "2024-08-24T12:03:18.000000Z",
"discount_amount": 0,
"discount_type": null,
"coupon_code": "0",
"coupon_discount_bearer": "inhouse",
"shipping_responsibility": "inhouse_shipping",
"shipping_method_id": 2,
"shipping_cost": 5,
"is_shipping_free": false,
"order_group_id": "5472-JTY60-1724500505",
"verification_code": "576939",
"verification_status": false,
"seller_id": 1,
"seller_is": "admin",
"shipping_address_data": {
"id": 3,
"customer_id": "0",
"is_guest": false,
"contact_person_name": "jhon",
"email": null,
"address_type": "permanent",
"address": "kgkfdhfjglkhvjk",
"city": "asdz",
"zip": "176231",
"phone": "+213837482923",
"created_at": null,
"updated_at": null,
"state": null,
"country": "Algeria",
"latitude": "0",
"longitude": "0",
"is_billing": false
},
"delivery_man_id": null,
"deliveryman_charge": 0,
"expected_delivery_date": null,
"order_note": null,
"billing_address": {
"id": 4,
"customer_id": "0",
"is_guest": false,
"contact_person_name": "joiujvkgulh",
"email": null,
"address_type": "permanent",
"address": "gytjdtfuykgill",
"city": "ljkgykuh",
"zip": "87685",
"phone": "+213448927332",
"created_at": null,
"updated_at": null,
"state": null,
"country": "Algeria",
"latitude": "0",
"longitude": "0",
"is_billing": true
},
"billing_address_data": {
"id": 4,
"customer_id": "0",
"is_guest": false,
"contact_person_name": "joiujvkgulh",
"email": null,
"address_type": "permanent",
"address": "gytjdtfuykgill",
"city": "ljkgykuh",
"zip": "87685",
"phone": "+213448927332",
"created_at": null,
"updated_at": null,
"state": null,
"country": "Algeria",
"latitude": "0",
"longitude": "0",
"is_billing": true
},
"order_type": "default_type",
"extra_discount": 0,
"extra_discount_type": null,
"free_delivery_bearer": "admin",
"checked": true,
"shipping_type": "order_wise",
"delivery_type": null,
"delivery_service_name": null,
"third_party_delivery_tracking_id": null,
"order_details": [
{
"id": 1,
"order_id": 100001,
"product_id": 1,
"seller_id": 1,
"digital_file_after_sell": null,
"product_details":
"{\"id\":1,\"added_by\":\"admin\",\"user_id\":1,\"name\":\"Basket-
R46\",\"slug\":\"basket-r46-
MF5DKH\",\"product_type\":\"physical\",\"category_ids\":\"[{\\\"id\\\":\\\"1\\\",\\\"
position\\\":1},{\\\"id\\\":\\\"2\\\",\\\"position\\\":2},
{\\\"id\\\":\\\"3\\\",\\\"position\\\":3}]\",\"category_id\":1,\"sub_category_id\":2,\"s
ub_sub_category_id\":3,\"brand_id\":1,\"unit\":\"kg\",\"min_qty\":1,\"refundable\":
1,\"digital_product_type\":null,\"digital_file_ready\":\"\",\"digital_file_ready_storage
_type\":null,\"images\":\"[{\\\"image_name\\\":\\\"2024-08-22-
66c76a9735c9e.webp\\\",\\\"storage\\\":\\\"public\\\"}]\",\"color_image\":\"[]\",\"t
humbnail\":\"2024-08-22-
66c76a973e8a2.webp\",\"thumbnail_storage_type\":\"public\",\"featured\":null,\"fla
sh_deal\":null,\"video_provider\":\"youtube\",\"video_url\":null,\"colors\":\"[]\",\"va
riant_product\":0,\"attributes\":\"null\",\"choice_options\":\"[]\",\"variation\":\"[]\",
\"digital_product_file_types\":[],\"digital_product_extensions\":
[],\"published\":0,\"unit_price\":20,\"purchase_price\":0,\"tax\":0,\"tax_type\":\"per
cent\",\"tax_model\":\"include\",\"discount\":0,\"discount_type\":\"percent\",\"curr
ent_stock\":20,\"minimum_order_qty\":1,\"details\":\"<p>this basket is very
good<\\/p>\",\"free_shipping\":0,\"attachment\":null,\"created_at\":\"2024-08-
22T16:43:03.000000Z\",\"updated_at\":\"2024-08-
22T16:43:03.000000Z\",\"status\":1,\"featured_status\":1,\"meta_title\":\"Basket-
R46\",\"meta_description\":\"this basket is very
good\",\"meta_image\":null,\"request_status\":1,\"denied_note\":null,\"shipping_co
st\":0,\"multiply_qty\":0,\"temp_shipping_cost\":null,\"is_shipping_cost_updated\":n
ull,\"code\":\"EAIVBG\",\"digital_file_ready_full_url\":
{\"key\":\"\",\"path\":null,\"status\":404},\"digital_variation\":[]}",
"qty": 1,
"price": 20,
"tax": 0,
"discount": 0,
"tax_model": "include",
"delivery_status": "pending",
"payment_status": "unpaid",
"created_at": "2024-08-24T11:55:05.000000Z",
"updated_at": "2024-08-24T11:55:05.000000Z",
"shipping_method_id": null,
"variant": "",
"variation": "[]",
"discount_type": "discount_on_product",
"is_stock_decreased": 1,
"refund_request": 0,
"digital_file_after_sell_full_url": {
"key": null,
"path": null,
"status": 404
},
"storage": []
}
]
},
{
"id": 100021,
"customer_id": 2,
"is_guest": false,
"customer_type": "customer",
"payment_status": "unpaid",
"order_status": "pending",
"payment_method": "cash_on_delivery",
"transaction_ref": "",
"payment_by": null,
"payment_note": null,
"order_amount": 18,
"admin_commission": "0.00",
"is_pause": false,
"cause": null,
"shipping_address": {
"id": 5,
"customer_id": "0",
"is_guest": false,
"contact_person_name": "Jhon",
"email": null,
"address_type": "permanent",
"address": "kgkfdhfjglkhvjk",
"city": "Asdz",
"zip": "176231",
"phone": "+213837482923",
"created_at": null,
"updated_at": null,
"state": null,
"country": "Algeria",
"latitude": "0",
"longitude": "0",
"is_billing": false
},
"created_at": "2024-08-31T01:14:56.000000Z",
"updated_at": "2024-08-31T01:15:03.000000Z",
"discount_amount": 0,
"discount_type": null,
"coupon_code": "0",
"coupon_discount_bearer": "inhouse",
"shipping_responsibility": "inhouse_shipping",
"shipping_method_id": 2,
"shipping_cost": 5,
"is_shipping_free": false,
"order_group_id": "7466-kqMsX-1725066896",
"verification_code": "539686",
"verification_status": false,
"seller_id": 1,
"seller_is": "admin",
"shipping_address_data": {
"id": 5,
"customer_id": "0",
"is_guest": false,
"contact_person_name": "Jhon",
"email": null,
"address_type": "permanent",
"address": "kgkfdhfjglkhvjk",
"city": "Asdz",
"zip": "176231",
"phone": "+213837482923",
"created_at": null,
"updated_at": null,
"state": null,
"country": "Algeria",
"latitude": "0",
"longitude": "0",
"is_billing": false
},
"delivery_man_id": null,
"deliveryman_charge": 0,
"expected_delivery_date": null,
"order_note": null,
"billing_address": {
"id": 6,
"customer_id": "0",
"is_guest": false,
"contact_person_name": "Jhon",
"email": null,
"address_type": "permanent",
"address": "kgkfdhfjglkhvjk",
"city": "Asdz",
"zip": "176231",
"phone": "+213837482923",
"created_at": null,
"updated_at": null,
"state": null,
"country": "Afghanistan",
"latitude": "0",
"longitude": "0",
"is_billing": true
},
"billing_address_data": {
"id": 6,
"customer_id": "0",
"is_guest": false,
"contact_person_name": "Jhon",
"email": null,
"address_type": "permanent",
"address": "kgkfdhfjglkhvjk",
"city": "Asdz",
"zip": "176231",
"phone": "+213837482923",
"created_at": null,
"updated_at": null,
"state": null,
"country": "Afghanistan",
"latitude": "0",
"longitude": "0",
"is_billing": true
},
"order_type": "default_type",
"extra_discount": 0,
"extra_discount_type": null,
"free_delivery_bearer": "admin",
"checked": true,
"shipping_type": "order_wise",
"delivery_type": null,
"delivery_service_name": null,
"third_party_delivery_tracking_id": null,
"order_details": [
{
"id": 2,
"order_id": 100021,
"product_id": 26,
"seller_id": 1,
"digital_file_after_sell": null,
"product_details":
"{\"id\":26,\"added_by\":\"admin\",\"user_id\":1,\"name\":\"Product
7\",\"slug\":\"kaskita-
x5FLJJ8D\",\"product_type\":\"physical\",\"category_ids\":\"[{\\\"id\\\":\\\"1\\\",\\\"
position\\\":1},{\\\"id\\\":\\\"2\\\",\\\"position\\\":2},
{\\\"id\\\":\\\"3\\\",\\\"position\\\":3}]\",\"category_id\":1,\"sub_category_id\":2,\"s
ub_sub_category_id\":3,\"brand_id\":1,\"unit\":\"kg\",\"min_qty\":1,\"refundable\":
1,\"digital_product_type\":null,\"digital_file_ready\":null,\"digital_file_ready_storage
_type\":\"public\",\"images\":\"[{\\\"image_name\\\":\\\"2024-08-28-
66cf3101e5a3d.webp\\\",\\\"storage\\\":\\\"public\\\"}]\",\"color_image\":\"[]\",\"t
humbnail\":\"2024-08-28-
66cf3101ee58c.webp\",\"thumbnail_storage_type\":\"public\",\"featured\":null,\"flas
h_deal\":null,\"video_provider\":null,\"video_url\":null,\"colors\":\"[]\",\"variant_pro
duct\":0,\"attributes\":null,\"choice_options\":\"[]\",\"variation\":\"[]\",\"digital_pro
duct_file_types\":null,\"digital_product_extensions\":null,\"published\":0,\"unit_pric
e\":13,\"purchase_price\":0,\"tax\":0,\"tax_type\":null,\"tax_model\":\"exclude\",\"d
iscount\":0,\"discount_type\":null,\"current_stock\":100,\"minimum_order_qty\":1,\
"details\":\"<p>This is an example product
description.<\\/p>\",\"free_shipping\":0,\"attachment\":null,\"created_at\":\"2024-
08-30T23:21:49.000000Z\",\"updated_at\":\"2024-08-
30T23:21:49.000000Z\",\"status\":1,\"featured_status\":1,\"meta_title\":null,\"meta_
description\":null,\"meta_image\":null,\"request_status\":1,\"denied_note\":null,\"s
hipping_cost\":null,\"multiply_qty\":null,\"temp_shipping_cost\":null,\"is_shipping_c
ost_updated\":null,\"code\":\"AOJDJPP\",\"digital_file_ready_full_url\":
{\"key\":null,\"path\":null,\"status\":404},\"digital_variation\":[]}",
"qty": 1,
"price": 13,
"tax": 0,
"discount": 0,
"tax_model": "exclude",
"delivery_status": "pending",
"payment_status": "unpaid",
"created_at": "2024-08-31T01:14:56.000000Z",
"updated_at": "2024-08-31T01:14:56.000000Z",
"shipping_method_id": null,
"variant": "",
"variation": "[]",
"discount_type": "discount_on_product",
"is_stock_decreased": 1,
"refund_request": 0,
"digital_file_after_sell_full_url": {
"key": null,
"path": null,
"status": 404
},
"storage": []
}
]
}
]

 Affichage d’une commande par id :


- Route : http://localhost/api/v4/orders/{id}
- Method : GET
- Response :
{
"id": 100001,
"customer_id": 2,
"is_guest": false,
"customer_type": "customer",
"payment_status": "unpaid",
"order_status": "pending",
"payment_method": "cash_on_delivery",
"transaction_ref": "",
"payment_by": null,
"payment_note": null,
"order_amount": 25,
"admin_commission": "0.00",
"is_pause": false,
"cause": null,
"shipping_address": {
"id": 3,
"customer_id": "2",
"is_guest": false,
"contact_person_name": "Jhon",
"email": null,
"address_type": "permanent",
"address": "kgkfdhfjglkhvjk",
"city": "Asdz",
"zip": "176231",
"phone": "+213837482923",
"created_at": null,
"updated_at": "2024-08-28T11:20:30.000000Z",
"state": null,
"country": "Algeria",
"latitude": "0",
"longitude": "0",
"is_billing": false
},
"created_at": "2024-08-24T11:55:05.000000Z",
"updated_at": "2024-08-24T12:03:18.000000Z",
"discount_amount": 0,
"discount_type": null,
"coupon_code": "0",
"coupon_discount_bearer": "inhouse",
"shipping_responsibility": "inhouse_shipping",
"shipping_method_id": 2,
"shipping_cost": 5,
"is_shipping_free": false,
"order_group_id": "5472-JTY60-1724500505",
"verification_code": "576939",
"verification_status": false,
"seller_id": 1,
"seller_is": "admin",
"shipping_address_data": {
"id": 3,
"customer_id": "0",
"is_guest": false,
"contact_person_name": "jhon",
"email": null,
"address_type": "permanent",
"address": "kgkfdhfjglkhvjk",
"city": "asdz",
"zip": "176231",
"phone": "+213837482923",
"created_at": null,
"updated_at": null,
"state": null,
"country": "Algeria",
"latitude": "0",
"longitude": "0",
"is_billing": false
},
"delivery_man_id": null,
"deliveryman_charge": 0,
"expected_delivery_date": null,
"order_note": null,
"billing_address": {
"id": 4,
"customer_id": "0",
"is_guest": false,
"contact_person_name": "joiujvkgulh",
"email": null,
"address_type": "permanent",
"address": "gytjdtfuykgill",
"city": "ljkgykuh",
"zip": "87685",
"phone": "+213448927332",
"created_at": null,
"updated_at": null,
"state": null,
"country": "Algeria",
"latitude": "0",
"longitude": "0",
"is_billing": true
},
"billing_address_data": {
"id": 4,
"customer_id": "0",
"is_guest": false,
"contact_person_name": "joiujvkgulh",
"email": null,
"address_type": "permanent",
"address": "gytjdtfuykgill",
"city": "ljkgykuh",
"zip": "87685",
"phone": "+213448927332",
"created_at": null,
"updated_at": null,
"state": null,
"country": "Algeria",
"latitude": "0",
"longitude": "0",
"is_billing": true
},
"order_type": "default_type",
"extra_discount": 0,
"extra_discount_type": null,
"free_delivery_bearer": "admin",
"checked": true,
"shipping_type": "order_wise",
"delivery_type": null,
"delivery_service_name": null,
"third_party_delivery_tracking_id": null,
"order_details": [
{
"id": 1,
"order_id": 100001,
"product_id": 1,
"seller_id": 1,
"digital_file_after_sell": null,
"product_details":
"{\"id\":1,\"added_by\":\"admin\",\"user_id\":1,\"name\":\"Basket-
R46\",\"slug\":\"basket-r46-
MF5DKH\",\"product_type\":\"physical\",\"category_ids\":\"[{\\\"id\\\":\\\"1\\\",\\\"positi
on\\\":1},{\\\"id\\\":\\\"2\\\",\\\"position\\\":2},
{\\\"id\\\":\\\"3\\\",\\\"position\\\":3}]\",\"category_id\":1,\"sub_category_id\":2,\"sub_s
ub_category_id\":3,\"brand_id\":1,\"unit\":\"kg\",\"min_qty\":1,\"refundable\":1,\"digital_
product_type\":null,\"digital_file_ready\":\"\",\"digital_file_ready_storage_type\":null,\"im
ages\":\"[{\\\"image_name\\\":\\\"2024-08-22-
66c76a9735c9e.webp\\\",\\\"storage\\\":\\\"public\\\"}]\",\"color_image\":\"[]\",\"thumb
nail\":\"2024-08-22-
66c76a973e8a2.webp\",\"thumbnail_storage_type\":\"public\",\"featured\":null,\"flash_de
al\":null,\"video_provider\":\"youtube\",\"video_url\":null,\"colors\":\"[]\",\"variant_prod
uct\":0,\"attributes\":\"null\",\"choice_options\":\"[]\",\"variation\":\"[]\",\"digital_produc
t_file_types\":[],\"digital_product_extensions\":
[],\"published\":0,\"unit_price\":20,\"purchase_price\":0,\"tax\":0,\"tax_type\":\"percent\
",\"tax_model\":\"include\",\"discount\":0,\"discount_type\":\"percent\",\"current_stock\"
:20,\"minimum_order_qty\":1,\"details\":\"<p>this basket is very
good<\\/p>\",\"free_shipping\":0,\"attachment\":null,\"created_at\":\"2024-08-
22T16:43:03.000000Z\",\"updated_at\":\"2024-08-
22T16:43:03.000000Z\",\"status\":1,\"featured_status\":1,\"meta_title\":\"Basket-
R46\",\"meta_description\":\"this basket is very
good\",\"meta_image\":null,\"request_status\":1,\"denied_note\":null,\"shipping_cost\":0,
\"multiply_qty\":0,\"temp_shipping_cost\":null,\"is_shipping_cost_updated\":null,\"code\"
:\"EAIVBG\",\"digital_file_ready_full_url\":
{\"key\":\"\",\"path\":null,\"status\":404},\"digital_variation\":[]}",
"qty": 1,
"price": 20,
"tax": 0,
"discount": 0,
"tax_model": "include",
"delivery_status": "pending",
"payment_status": "unpaid",
"created_at": "2024-08-24T11:55:05.000000Z",
"updated_at": "2024-08-24T11:55:05.000000Z",
"shipping_method_id": null,
"variant": "",
"variation": "[]",
"discount_type": "discount_on_product",
"is_stock_decreased": 1,
"refund_request": 0,
"digital_file_after_sell_full_url": {
"key": null,
"path": null,
"status": 404
},
"storage": []
}
]
}

 Affichage d’une commande par filtre (colonnes préférées) :


- Route : http://localhost/api/v4/orders/{id}/columns
- Method : GET
- Params : ?c=col1,col2,...&o=col1,col2,...
c : utilisé pour spécifier les colonnes préférées de la table orders.
o: utilisé pour spécifier les colonnes préférées de la table order_details associée.
( exemple : ?c=id,order_amount&o=product_id,price,qty,payment_status)

- Response :

{
"id": 100001,
"order_amount": 25,
"order_details": [
{
"product_id": 1,
"price": 20,
"qty": 1,
"payment_status": "unpaid"
}
]
}

 Modification d’une commande :


- Route :
http://localhost/api/v4/orders/change/{id}
- Method : PUT

Body: ( on va changer le payment_status et le seller_id qui se trouve dans


order_details )
{
"payment_status": "paid",
"order_details": [
{
"id": 1,
"seller_id": 2,
"payment_status": "paid"
},
{
"id": 2,
"seller_id": 3,
"payment_status": "paid"
}
]
}
- Response :
- Avant modification :

{
"id": 100001,
"customer_id": 2,
"is_guest": false,
"customer_type": "customer",
"payment_status": "unpaid",
....
....
....

"order_details": [
{
"id": 1,
"order_id": 100001,
"product_id": 1,
"seller_id": 1,
.....
]

- Après modification :

{
"id": 100001,
"customer_id": 2,
"is_guest": false,
"customer_type": "customer",
"payment_status": "paid",
....
....
....

"order_details": [
{
"id": 1,
"order_id": 100001,
"product_id": 1,
"seller_id": 2,
.....
]

3-Notes :
 Pour que les images s’affichent correctement sur le site :
1- Il faut qu’il se trouve dans les chemins suivants :
- Thumblains (Requiered) :
“C:\xampp\htdocs\storage\app\public\product\thumbnail”
- Products (Required) :
“C:\xampp\htdocs\storage\app\public\product”
- Meta (Optional) :
“C:\xampp\htdocs\storage\app\public\product\meta”

2- Il faut assurer que la requête doit avoir les champs comme ceci :
{....
"images": [{"image_name":"2024-08-28-
66cf3101e5a3d.webp","storage":"public"}],
"thumbnail": "2024-08-28-66cf3101ee58c.webp",
"thumbnail_storage_type": "public",
....}
 Le slug d’un produit doit être unique pour que ce dernier d’affiche correctement
dans le site.

You might also like