نظرة عامة
توفر واجهة برمجة سطورإنو تحسينات جديدة وأداء أفضل وميزات جديدة للعملاء. تقدم هذه الوثيقة معلومات مفصلة عن الـAPI — يُنصح بقراءتها كاملة قبل تنفيذ التكامل في أي نظام.
هيكل API
توفر سطورإنو نقاط وصول API لكل من أنظمة التطوير والإنتاج. للتطوير والاختبار الأولي، استعمل نقطة وصول التطوير.
ترويسات الطلب
تتطلب واجهة برمجة سطورإنو الترويستين التاليتين.
| الترويسة | القيمة الممكنة | الوصف |
|---|---|---|
Accept | application/json | للحصول على الاستجابة بصيغة JSON، يجب إرسال هذه الترويسة مع الطلب بقيمة application/json |
X-auth-token | String | الرمز (token) الذي تحصل عليه شركتك بعد التسجيل |
إنشاء طلب
نرسل طلب إنشاء الطلبية إلى نقطة الوصول الخاصة بك بصيغة JSON التالية.
{ RECEIVER: 'BADR AGRIR', //full name SELLERID: 2343, //seller ID in your company PHONE: '06xx-xx-xx-xx', //phone number string CITY: 'city of customer', //string COUNTRY: 'USA', //country of customer, string //You can find the products field only if you have the warehousing service PRODUCTS: [ { product: { _id: '23412' //id of product in your platform }, quantity: 4, unitPrice: 34 }, {...}, ], ADDRESS: 'new york 1109 road 02', //address of customer, string TOTAL_PRICE: 15, //total price, integer SERVICE: 'CASH IN DELIVERY', //string SOURCE: 'STOREINO' }
{ status: 200, data: { orderRef: 23234 //ID of the order in your platform } }
{ status: 400, data: { error: 'phone number not valid' } }
استيراد منتج (هذه الواجهة مطلوبة فقط إذا كانت لديك خدمة التخزين)
نرسل طلب إنشاء المنتج إلى نقطة الوصول الخاصة بك بصيغة JSON التالية.
{ name: 'phone', //title of the product picture: 'https/image.xx/', //url of the product description: 'new product', //description of the product source: 'STOREINO', sellerId: '', //id of the seller in your company price: 15, quantity: 122 //quantity in stock }
{ status: 200, data: { productRef: 23234, //ID of the product in your platform sellerId: 233 //ID of the seller in your platform } }
{ status: 400, data: { error: 'title not valid' } }
تحديث حالة الطلب
صيغة الجسم (body) المقبولة
BASE-URL/companies/changeStatus?source=NAME-COMPANY// headers above are necessary { orderId: 423, //ID of the order in your database status: '', //new status note: 'delivered 12:12 AM' }
{ status: 200, data: { status: 'status changed' } }
تسجيل دخول العميل
صيغة الجسم (body) المقبولة
BASE-URL/companies/login?source=NAME-COMPANY{ email: 'email@xxx.com', password: '......', source: 'STOREINO' }
{ status: 200, data: { sellerId: '423' //ID of the seller in your database } }
{ status: 400, data: { error: 'email or password is invalid' } }
تسجيل عميل (هذه الواجهة اختيارية)
صيغة الجسم (body) المقبولة
BASE-URL/companies/register?source=NAME-COMPANY{ fullName: '', email: 'email@xxx.com', password: '......', numberPhone: '', source: 'STOREINO' }
{ status: 200, data: { sellerId: '423' //ID of the seller in your database } }
{ status: 400, data: { error: 'EX' } }
التحقق من العميل (هذه الواجهة مطلوبة فقط إذا استخدمت واجهة التسجيل API)
صيغة الجسم (body) المقبولة
BASE-URL/companies/validation?source=NAME-COMPANY// headers above are necessary { sellerId: 423, //ID of the seller in your database confirmed: true }
{ status: 200, data: { connected: true } }
