Torood API === ###### tags: `Torood` All functionalities are accessible from an Torood API host: https://torood-gaza.herokuapp.com/api/v1/dev/rest ## Token - API Key Ask for your own token and API key from Torood support team. ## Authentications Below header elements are mandatory for authentication purposes: ``` token: token x-api-key: API_KEY Content-Type: application/json ``` ## API's List ## Postman Collection > https://www.getpostman.com/collections/40b2d11bd330d0df5854 ### Add new trader store address Add store address to use in the add package API. ##### EndPoint ``` /add-store-address ``` ##### Method ``` POST ``` ##### Request Body ```json= { "name": "work", "city": "غزة", "neighborhood": "الرمال", "street": "عايدية", "closeTo": "اقرب معلم ", } ``` ##### Response Returns the new traderStoreAddressId. ```json= { statusCode: 200, data: { traderStoreAddressId: 3 }, message: "Success", } ``` ### Get trader store addresses list GEt store address list to use in the add package API. ##### EndPoint ``` /store-address-list ``` ##### Method ``` GET ``` ##### Request ##### Response Returns all store address for the trader. ```json= { statusCode: 200, data: { addressList: [ { "id": 1, "name": "work", "city": "غزة", "neighborhood": "الرمال", "street": "عايدية", "closeTo": "اقرب معلم ", },{ "id": 2, "name": "home", "city": "رفح", "neighborhood": "الحي", "street": "شارع الشوارع", "closeTo": "مطعم الفلاح", }, ] }, message: "Success", } ``` ### Calculate the delivery price To calculate the package price. ##### EndPoint ``` /calculate-price ``` ##### Method ``` POST ``` ##### Request Body ```json= { "promoCode": "ALI25", "fromCity": "غزة", "toCity": "رفح", "price": 20, "isEndPrice": true, "isWait": false, } ``` ##### Response Returns total price for the package. ```json= { statusCode: 200, data: { totalPrice: 26 }, message: "Success", } ``` ### Get List Of Valied Cities To get the list of valid cities City must be a valid to add a new package. ##### EndPoint ``` /cities-list ``` ##### Method ``` GET ``` ##### Request ##### Response Returns a list of cities. ```json= { statusCode: 200, data: [ { "id": 1, "name": "غزة" },{ "id": 2, "name": "الشمال" },{ "id": 3, "name": "رفح" },{ "id": 4, "name": "الوسطى" },{ "id": 5, "name": "خانيونس" } ], message: "Success", } ``` ### Add New Package To add a new package to your Torood account. ##### EndPoint ``` /add-package ``` ##### Method ``` POST ``` ##### Request Body ```json= { "customer": { "mobile": "0597185554", "name": "abdallah ammar", "city": "غزة", "neighborhood": "الرمال", "street": "عايدية", "closeTo": "اقرب معلم ", }, "traderStoreAddressId": 1, "name": "اسم الطرد", "price": 13, "note": "ملاحظة حول الطرد", "isEndPrice": true, "isWait": true, } ``` ##### Response Returns code ( trackId ) for added package. ```json= { statusCode: 200, data: { code: "a6d3q" }, message: "Success", } ``` --- --- ### Track Package To get general data and track list about your package. ##### EndPoint ``` /track-package/:code ``` ##### Method ``` GET ``` ##### Request Params params ```json= { "code": "a6d3q" } ``` ##### Response ```json= { "statusCode": 200, "data": [ { "name": "اسم الطرد", "note": "الملاحظة", "code": "a6d3q", "customer": { "mobile": "0597185554", "name": "abdallah ammar", "city": "غزة", "neighborhood": "الرمال", "street": "عايدية", "closeTo": "اقرب معلم ", }, "isEndPrice": false, "isWait": false, "isRetrieve": false, "packagePositionId": "مع الزبون/ تم التسليم", "trader": { "mobile": "0597185554", "name": "abdallah ammar", "city": "غزة", "neighborhood": "الرمال", "street": "عايدية", "closeTo": "اقرب معلم ", } "trackList": [ { "note": "مع الزبون/ تم التسليم" "createdAt": "2021-09-10T16:32:32.966Z" { "note": "مع الكابتن/ جاري التسليم للزبون", "createdAt": "2021-09-10T16:32:03.960Z" }, { "note": "في مركز الفرز", "createdAt": "2021-09-10T16:32:03.957Z" }, { "note": "طرد جديد/ مع المندوب", "createdAt": "2021-09-10T16:32:03.954Z" }, { "note": "طرد جديد/ مع التاجر", "createdAt": "2021-09-10T16:31:05.531Z" } ], "bill": { "price": 20, "deliveryCost": 6, "discountAmount": 1, "customerPay": 25, "isPaid": false, }, }, ], "message": "Success" } ``` ### Get trader daily bill To get daily bill for you package. ##### EndPoint ``` /daily-bill?date="" ``` ##### Method ``` GET ``` ##### Request Params params ```json= { "date": "2022-09-07" } ``` ##### Response ```json= { "statusCode": 200, "data": [ { "addDate": "2022-09-07", "discount": 10, "addition": 10, "packagesPrice": 250, "promoCodeDiscount": 2, "totalForTrader": 240, "deliveryCost": 12, "packagesNumber": 2, "packagesList": [ { "code": "asdf9", "name": "اسم الطرد", "customerName": "abdallah ammar", "customerCity": "غزة", "collectFromCustomer": 20, "deliveryPrice": 6, "promoCodeDiscount": 0, "netForTrader": 14, "status": "تم التوصيل", "paymentMethod": "cash", "note": "ملاحظة التوصيل", "createdAt": "2021-09-10T16:32:32.966Z" },{ "code": "asdf9", "name": "اسم الطرد", "customerName": "abdallah ammar", "customerCity": "غزة", "collectFromCustomer": 20, "deliveryPrice": 6, "promoCodeDiscount": 0, "netForTrader": 14, "status": "تم التوصيل", "paymentMethod": "cash", "note": "ملاحظة التوصيل", "createdAt": "2021-09-10T16:32:32.966Z" }, ], }, ], "message": "Success" } ``` --- ## Catch Hook We will send a request to your catch hook endpoint after every update on the package Example >> update price, status and add notes, etc ##### EndPoint ``` www.your-domain.com/your-endpoint ``` ##### Method ``` POST ``` ##### Request Body ```json= { "statusCode": 200, "data": [ { "name": "اسم الطرد", "note": "الملاحظة", "code": "a6d3q", "customer": { "mobile": "0597185554", "name": "abdallah ammar", "city": "غزة", "neighborhood": "الرمال", "street": "عايدية", "closeTo": "اقرب معلم ", }, "isEndPrice": false, "isWait": false, "isRetrieve": false, "packagePositionId": "مع الزبون/ تم التسليم", "trader": { "mobile": "0597185554", "name": "abdallah ammar", "city": "غزة", "neighborhood": "الرمال", "street": "عايدية", "closeTo": "اقرب معلم ", } "trackList": [ { "note": "مع الزبون/ تم التسليم" "createdAt": "2021-09-10T16:32:32.966Z" { "note": "مع الكابتن/ جاري التسليم للزبون", "createdAt": "2021-09-10T16:32:03.960Z" }, { "note": "في مركز الفرز", "createdAt": "2021-09-10T16:32:03.957Z" }, { "note": "طرد جديد/ مع المندوب", "createdAt": "2021-09-10T16:32:03.954Z" }, { "note": "طرد جديد/ مع التاجر", "createdAt": "2021-09-10T16:31:05.531Z" } ], "bill": { "price": 20, "deliveryCost": 6, "discountAmount": 1, "customerPay": 25, "isPaid": false, }, }, ], "message": "Success" } ``` --- ## List of package status ```json { 0: "قيد العمل", 1: "نجحت العملية", 2: "لا يرد على الهاتف", 3: "رفض الزبون الاستلام", 4: "تاجيل", 5: "طلب الغاء", 6: "تم الموافقة الالغاء", 7: "تم الالغاء", 8: "فشلت العملية", 9: "مؤجلة على الهاتف", } ``` 0 => عملية التوصيل او الارجاع جارية 1 => نجحت عملية التوصيل او الارجاع 2 => الزبون لا يرد على الهاتف 3 => رفض الزبون استلام الطرد 4 => تم تأجيل التوصيل بواسطة الزبون او الديلفري 5 => تم تقديم طلب الغاء بواسطة التاجر 6 => تم الموافقة على طلب الالغاء بواسطة الادارة 7 => تم الغاء الطرد من الادارة بشكل مباشر 8 => فشلت عملية التوصيل او الارجاع 9 => تم تأجيل الطرد من قبل الكابتن بعد التواصل مع الزبون على الهاتف ```json { 0: "توصيل", 1: "إرجاع", } ``` 0 => عملية توصيل من التاجر للزبون 1 => عملية ارجاع من الزبون للتاجر ```json { 1: "مع التاجر", 2: "مع المندوب", 3: "في مركز الفرز", 4: "مع الكابتن", 5: "استلم الزبون", } ``` <div style="direction: rtl" > - طرد جديد/ مع التاجر - طرد جديد/ مع المندوب - في مركز الفرز - مع الكابتن/ جاري التسليم للزبون - مع الكابتن/ لم يرد عبر الهاتف - مع الكابتن، رفض الزبون الاستلام - مع الكابتن/ مؤجل عبر الهاتف - مع الكابتن، الزبون ألغى الطرد عبر التطبيق - مع الكابتن، الزبون أجل عبر التطبيق - مع الزبون/ تم التسليم - مع الكابتن/ جزء من الطرد مرجع - في المخزن/ جزء مرجع - مع المندوب/ جزء مرجع - مع التاجر/ استلم جزء مرجع - مع الزبون/ طلب إرجاع - مع الكابتن/ طرد مرجع - في المخزن/ طرد مرجع - مع المندوب/ طرد مرجع - مع التاجر/ استلم طرد مرجع - مع الكابتن/ طلب إلغاء من التاجر - في المخزن/ طلب إلغاء من التاجر - مع المندوب/ طلب إلغاء من التاجر - مع الكابتن/ تم الموافقة على الالغاء - في المخزن/ تم الموافقة على الالغاء - مع المندوب/ تم الموافقة على الالغاء - مع المندوب/ فشلت المحاولات - في المخزن/ فشلت المحاولات - مع الكابتن/ فشلت المحاولات - مع المندوب مرجع/ فشلت المحاولات - في المخزن مرجع/ فشلت المحاولات - مع الكابتن مرجع/ فشلت المحاولات </div>