Spectre API — TEST Documentation
Use this page to test the authentication API on the isolated TEST environment.
https://test.spacto.ly
Module Version:
18.0.1.4.0
This documentation is for TEST only. Do not use the production endpoint for QA.
1. Quick Start
- Download and import the Postman Collection.
- Download and import the TEST Environment.
- Select the imported environment in Postman.
- Use a fresh test phone number.
- Run the requests in the order shown below.
2. OTP for QA
QA users do not need server access. Authorized testers can open the temporary portal page:
The user must have the Spectre Auth Tester access group. The screen is read-only for testers and shows the phone, OTP code, expiry, consumed state, and attempt counters.
3. Full Authentication Flow
| # | Action | Method | Endpoint | Expected |
|---|---|---|---|---|
| 1 | Register | POST | /auth/register | 200 + OTP metadata |
| 2 | Verify OTP | POST | /auth/verify-otp | 200 + token pair |
| 3 | Login | POST | /auth/login | 200 + token pair |
| 4 | Refresh Token | POST | /auth/refresh | 200 + rotated token pair |
| 5 | Get Profile | GET | /auth/profile | 200 + user |
| 6 | Update Profile | PUT | /auth/profile | 200 + updated user |
| 7 | Logout | POST | /auth/logout | 200 + ok=true |
4. Example Register Request
POST /auth/register
Content-Type: application/json
{
"phoneNumber": "+218912345678",
"password": "123456"
}
5. Refresh Token
POST /auth/refresh
Content-Type: application/json
{
"refreshToken": ""
}
Refresh tokens are rotated. After a successful refresh, save both returned tokens. Reusing the old refresh token must return HTTP 401.
6. Negative Test Checklist
| Case | Expected |
|---|---|
| Login with wrong password | 401 |
| Register invalid phone number | 400 |
| Register already verified phone | 409 |
| Profile without Bearer token | 401 |
| Verify incorrect OTP | 400 |
| Resend OTP before cooldown | 429 |
| Refresh with missing token | 401 |
| Use access token as refresh token | 401 |
| Reuse rotated refresh token | 401 |
| Use access token after logout | 401 |
7. Completion Checklist
- Register returns OTP metadata.
- OTP can be read by an authorized tester from Odoo.
- OTP verification returns access + refresh tokens.
- Login succeeds with the verified phone and password.
- Profile read and update work with the access token.
- Refresh returns a new token pair and rejects replay of the old refresh token.
- Logout revokes the current access token.
- All negative cases return the expected HTTP status.
8. توثيق واجهات Spectre الجديدة — API Inventory
تتضمن الملفات المرفقة Auth وCatalog وCheckout وOrders وWallet وDPay وDriver وDelivery Proof وTracking وInvoice. الأمثلة مخصصة للاختبار اليدوي فقط، وليست شهادة بأن كل مسار يعمل في اختبار تكاملي مكتمل.
نزّل Collection وEnvironment الجديدين من أعلى الصفحة، ثم استورد الملفين معًا إلى Postman. استخدم بيانات اختبار فقط واضبط Token الخاص بدور Customer أو Driver أو Restaurant. بعض عمليات POST المالية والتسليم تحتاج بيانات فعلية داخل نسخة الاختبار.
حالة التكامل: SMS الحقيقي وGateway Payment وFCM وتخزين إثبات التسليم والتتبع الخارجي تتطلب إعدادات ومفاتيح وموافقات منفصلة. لا تفترض أنها مفعلة.
Invoice PDF: GET /api/v1/orders/{id}/invoice.pdf لطلب مدفوع يخص نفس العميل، ثم راجع اتجاه اللغة العربية وخطوط PDF. غير المدفوع يُرفض.
GET /.well-known/jwks.jsonPOST /api/v1/auth/loginPOST /api/v1/auth/logoutGET /api/v1/auth/profilePOST /api/v1/auth/refresh
GET /api/v1/restaurant/orders/pendingGET /api/v1/restaurant/orders/{ident}POST /api/v1/restaurant/orders/{ident}/acceptPOST /api/v1/restaurant/orders/{ident}/reject
GET /api/v1/catalog/image/{kind}/{ident}GET /api/v1/categoriesGET /api/v1/homeGET /api/v1/productsGET /api/v1/products/{product_id}
POST /api/v1/cart/validatePOST /api/v1/checkout/quoteGET /api/v1/payment-methods
GET /api/v1/configGET /api/v1/geo/ref-data
DELETE /api/v1/favoritesGET /api/v1/favoritesPOST /api/v1/favoritesPOST /api/v1/feedbackGET /api/v1/notifications
GET /api/v1/orders/{ident}/invoice.pdf
GET /api/v1/addressesPOST /api/v1/addressesDELETE /api/v1/addresses/{ident}PUT /api/v1/addresses/{ident}PUT /api/v1/addresses/{ident}/default
POST /api/v1/driver/media/upload-ticketsPOST /api/v1/driver/tasks/{ident}/deliverPOST /api/v1/driver/tasks/{ident}/fail
GET /api/v1/wallet/topups/methodsGET /api/v1/wallet/topups/{reference}POST /api/v1/wallet/topups/{reference}/checkPOST /api/v1/wallet/topups/{reference}/startPOST /api/v1/wallet/topups/{reference}/verify
GET /api/v1/payments/{reference}/status
POST /api/v1/driver/auth/loginPOST /api/v1/driver/auth/logoutPOST /api/v1/driver/auth/refreshPUT /api/v1/driver/availabilityGET /api/v1/driver/me
POST /api/v1/driver/cash/remittancesPOST /api/v1/driver/cash/remittances/{ident}/confirmGET /api/v1/driver/earnings/ledgerGET /api/v1/driver/earnings/summaryGET /api/v1/driver/warehouses
POST /api/v1/driver/heartbeatGET /api/v1/driver/offers/currentPOST /api/v1/driver/offers/{ident}/acceptPOST /api/v1/driver/offers/{ident}/reject
GET /api/v1/driver/tasks/activeGET /api/v1/driver/tasks/historyGET /api/v1/driver/tasks/{ident}POST /api/v1/driver/tasks/{ident}/arrive-storePOST /api/v1/driver/tasks/{ident}/head-to-store
POST /api/v1/devices
POST /api/v1/orders/{ident}/paymentsGET /api/v1/orders/{ident}/payments/{reference}POST /api/v1/orders/{ident}/payments/{reference}/checkPOST /api/v1/orders/{ident}/payments/{reference}/startPOST /api/v1/orders/{ident}/payments/{reference}/verify
GET /api/v1/ordersPOST /api/v1/ordersGET /api/v1/orders/{ident}POST /api/v1/orders/{ident}/cancelPOST /api/v1/orders/{ident}/reorder
POST /api/v1/auth/password/forgotPOST /api/v1/auth/password/reset
PUT /api/v1/auth/profile
POST /api/v1/driver/tracking/grantPOST /api/v1/orders/{ident}/tracking/grant
GET /api/v1/walletPOST /api/v1/wallet/topupsGET /api/v1/wallet/transactions
الأمثلة الباقية موجودة داخل Collection. تأكد من HTTP Status وdata/error وtraceId عند الفشل. لا تستخدم Run Collection لتشغيل عمليات إنشاء أو دفع أو تسليم جماعيًا.