API
the Wakilni offers an API to help create and manage orders from third-party applications.
Developers can use this API to integrate Wakilni into their custom applications.
Below are steps required, along with detailed documentation on the API.
Testing environment
For Testing
use the data below instead of the data in the Production Environment section
URL
-> https://api-dev.wakilni.com
Setup
You need to register as a new client in https://dev.wakilni.com/sign-up
and complete the integration as followed in the documentation.
Production environment
If everything went right, please find the Production
data (use data below instead of the data in the Testing Environment section)
URL
-> https://api.wakilni.com
JORDAN URL
-> https://jordan-api.wakilni.com
Integration with Wakilni steps:
Each client will be able to generate an access token that is attached to your account to be used in the API.
Login to customer back office
Go to Settings
Open tab “Api Tokens”
Click “Link to your custom app”
Enter your shop name/label.
Click create
A key/secret combination will be created for this client.
Copy these credentials and pass them to the request of the auth api.
A token will be generated, which you can pas as a bearer token in the other apis.
Order flow
Bulk process is divided into 2 flows: pickup bulk and delivery bulk
Pickup bulk: driver pickups the product from the vendor
Delivery bulk: driver delivers the product to the recipient
Shipping price: Wakilni has default delivery prices based on pickup/delivery locations. Also, each customer can have his own customized prices.
Api process:
Start bulk: creates pickup bulk order (multiple bulks can be created)
Add delivery: creates delivery order related to pickup bulk (multiple deliveries can be created)
End bulk: orders become active and are sent to portal for shipping
Show order status: shows order status based on the flow update Status/ Status Code:
PENDING = 1
CONFIRMED = 2
DECLINED = 6
CANCELED = 7
PROCESSING = 3
SUCCESS = 4
FAILED = 5
CLOSED_FAILED = 8
POSTPONED = 9
PENDING_CANCELLATION = 10
SUCCESS, REJECTED = 4
When the order is delivered but the client rejected it
Authentication
API: https://api.wakilni.com/api/v2/third_party/auth_token
Method: GET
Body:
key
: App keysecret
: App secret
Response
Start bulk
API: https://api.wakilni.com/api/v2/clients/start_bulk
Method: POST
Header: Authorization: Bearer {token}
Body:
location_id
: customer’s location id reference from your applongitude
: customer’s location’s longitudelatitude
: customer’s location’s latitudefloor
: customer’s location’s floorarea
: it is preferable to send us the area name from the list provided from get area’s list
Response
Add delivery
API: https://api.wakilni.com/api/v2/clients/add_delivery/{bulk_id}
Method: POST
Header: Authorization: Bearer {token}
Body:
get_order_details
: Set to true if you want to display order details after creating orderget_barcode
: Set to true if you want the barcode label returnedwaybill
: To reference or identify your orderreceiver_id
: The recipient’s unique reference id from your app or systemFor example: your recipient's id in your system is 123, then
"receiver_id" : 123
receiver_first_name
: Recipient’s first namereceiver_last_name
: Recipient’s last namereceiver_phone_number
: Recipient’s phone numberreceiver_gender
: Recipient’s gender (1 -> male, 2 -> female)receiver_email
: Recipient’s emailreceiver_secondary_phone_number
: Recipient’s secondary phone numberreceiver_location_id *
: The recipient’s location's unique reference id from your app or systemFor example, your recipients shipping address location id is 123, then
"receiver_location_id" : 123
receiver_longitude
: Customer’s location’s longitudereceiver_latitude
: Customer’s location’s latitudereceiver_building
: Customer’s location’s buildingreceiver_floor
: Customer’s location’s floorreceiver_directions
: Customer’s location’s directionsreceiver_area
: It is preferable to send us the area name from the list provided from get area’s listcurrency
: 1 -> USD, 2 -> LBPcash_collection_type_id
: (paid: 54, on delivery: 52)type_id
: (paper: 57, regular box: 58, small box: 59, large box: 60, very large box: 61)
Response:
Note: for use of barcode label to display barcode image, add the blob value to the image src as follows:
End bulk
API: https://api.wakilni.com/api/v2/clients/end_bulk/{bulk_id}
Method: POST
Header: Authorization: Bearer {token}
Response:
Show order status
API: https://api.wakilni.com/api/v2/clients/orders/{id}
Method: POST
Header: Authorization: Bearer {token}
Response:
Show order status from tracking id
API: https://api.wakilni.com/api/v2/clients/tracking/orders/{tracking_id}
Method: POST
Header: Authorization: Bearer {token}
Response:
Cancel order
API: https://api.wakilni.com/api/v2/clients/orders/{id}/cancel
Method: PUT
Header: Authorization: Bearer {token}
Body:
reason
: Reason for canceling the order
Response:
Note: You are able to cancel an order only if the status is pending
Get areas
API: https://api.wakilni.com/api/v2/areas
Method: GET
Header: Authorization: Bearer {token}
Pagination: https://api.wakilni.com/api/v2/areas?with_pagination=true&page=2
Filter: https://api.wakilni.com/api/v2/areas?search=name:beirut&searchJoin=and&with_filter=true
Pagination and Filter: https://api.wakilni.com/api/v2/areas?search=name:beirut&searchJoin=and&with_filter=true&with_pagination=true&page =2
Get order status
API: https://api.wakilni.com/api/v2/clients/orders/status?tracking_id={tracking_id}
Method: GET
Header: Authorization: Bearer {token}
Response:
Example response:
Last updated