ð Automatic Route Optimization ð
ð AI āļāļēāļĢāļāļąāļāđāļŠāđāļāļāļēāļāļāļēāļĢāļŠāđāļāļŠāļīāļāļāđāļēāļŦāļĨāļēāļĒāļāļļāļāļāļĒāđāļēāļāļāļąāļāļāļĢāļīāļĒāļ° ð
Welcome to the Automatic Route Optimization API, version 1.0, an AI product developed by iApp Technology Co., Ltd. Our API helps optimize delivery routes by finding the most efficient path between multiple destinations while considering various constraints like vehicle capacity, time windows, and traffic conditions.
Getting Startedâ
-
Prerequisites
- An API key from iApp Technology
- List of delivery locations with coordinates
- Vehicle and delivery constraints
- Maximum locations per request: 100
-
Quick Start
- Fast route calculation
- Real-time traffic consideration
- Multiple vehicle support
- Constraint-based optimization
-
Key Features
- Optimized multi-stop routing
- Vehicle capacity planning
- Time window scheduling
- Real-time traffic integration
- Multiple vehicle fleet support
-
Security & Compliance
- GDPR and PDPA compliant
- Secure API endpoints
- Data encryption in transit
Please visit iApp AI Portal to view your existing API key or request a new one.
Features and Capabilitiesâ
Core Featuresâ
The Route Optimization API provides an efficient way to plan and optimize delivery routes. Below is a summary of its key features:
-
Route Planning
- Automatically optimizes routes based on the origin and destinations.
- Calculates the shortest possible route, reducing fuel consumption and travel time.
-
Driver Management
- Supports assigning multiple drivers for larger delivery operations.
- Dynamic route adjustments based on the number of available drivers.
-
Customizable Delivery Details
- Allows specifying delivery instructions for:
- Customer care team (e.g., handling notes or instructions).
- Drivers (e.g., drop-off points, call instructions).
- Supports detailed input for each delivery stop, including:
- Recipient name, phone number, email, and address.
- Description of the delivery item.
- Allows specifying delivery instructions for:
-
Distance Calculation
- Provides the total distance (in kilometers) for the optimized route.
- Helps in tracking delivery costs and planning logistics effectively.
Request Exampleâ
curl --location 'https://api.iapp.co.th/route-optimization' \
--header 'apikey: iapp-health-check' \
--header 'Content-Type: application/json' \
--data-raw '{
"driverSize": -1,
"origin": {
"address": "āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ",
"latitude": 13.7882814,
"longitude": 100.5528693
},
"routes": [
{
"customerName": "Kobkrit Viriyayudhakorn",
"customerPhone": "0812345678",
"customerMail": "abc@google.com",
"customerAddress": "202/1 āļāļāļĒ āļāļīāļāļāļēāļĄāļĢāļ° 6 āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400",
"item": "Lanch box p23",
"instructionCC": "Next to Rachativee BTS station",
"instructionDriver": "Call me when arrive",
"latitude": 13.788463744195484,
"longitude": 100.5550741266538
},
{
"customerName": "Tanun C Lannon",
"customerPhone": "0890042785",
"customerMail": "def@google.com",
"customerAddress": "Big C Saphan Kwai",
"item": "2 Box of Coffee"
}
]
}'
Response Exampleâ
{
"jobs": [
{
"customerName": "Kobkrit Viriyayudhakorn",
"customerPhone": "0812345678",
"customerMail": "abc@google.com",
"customerAddress": "202/1 āļāļāļĒ āļāļīāļāļāļēāļĄāļĢāļ° 6 āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400",
"item": "Lanch box p23",
"instructionCC": "Next to Rachativee BTS station",
"instructionDriver": "Call me when arrive",
"latitude": 13.788463744195486,
"longitude": 100.5550741266538
},
{
"customerName": "Tanun C Lannon",
"customerPhone": "0890042785",
"customerMail": "def@google.com",
"customerAddress": "Big C Saphan Kwai",
"item": "2 Box of Coffee",
"instructionCC": "",
"instructionDriver": ""
}
],
"numberOfDrops": 2,
"routes": [
"202/1 āļāļāļĒ āļāļīāļāļāļēāļĄāļĢāļ° 6 āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400",
"Big C Saphan Kwai"
],
"totalDistanceKm": 5.32
}
API Referenceâ
Endpointâ
POST
https://api.iapp.co.th/route-optimization
Request Parametersâ
Headers
Key | Required | Description |
---|---|---|
apikey | Yes | API key for authentication. |
Content-Type | Yes | Must be set to application/json . |
Body (JSON)
Key | Type | Required | Description |
---|---|---|---|
driverSize | Integer | Yes | The number of drivers available for delivery. Use -1 for auto-optimize. |
origin | Object | Yes | The starting point of the delivery route. |
origin.address | String | Yes | Address of the origin. |
origin.latitude | Float | Yes | Latitude coordinate of the origin. |
origin.longitude | Float | Yes | Longitude coordinate of the origin. |
routes | Array of Objects | Yes | List of delivery destinations. |
routes[].customerName | String | Yes | Name of the recipient. |
routes[].customerPhone | String | Yes | Phone number of the recipient. |
routes[].customerMail | String | No | Email address of the recipient. |
routes[].customerAddress | String | Yes | Address of the delivery location. |
routes[].item | String | Yes | Description of the delivery item. |
routes[].instructionCC | String | No | Instructions for the customer care team. |
routes[].instructionDriver | String | No | Instructions for the delivery driver. |
routes[].latitude | Float | No | Latitude coordinate of the destination. |
routes[].longitude | Float | No | Longitude coordinate of the destination. |
Response Parametersâ
Key | Type | Description |
---|---|---|
jobs | Array of Objects | Details of the delivery jobs including destination info. |
jobs[].customerName | String | Name of the recipient. |
jobs[].customerPhone | String | Phone number of the recipient. |
jobs[].customerMail | String | Email of the recipient (if provided). |
jobs[].customerAddress | String | Address of the delivery location. |
jobs[].item | String | Description of the delivery item. |
jobs[].instructionCC | String | Instructions for customer care. |
jobs[].instructionDriver | String | Instructions for the delivery driver. |
jobs[].latitude | Float | Latitude of the destination. |
jobs[].longitude | Float | Longitude of the destination. |
numberOfDrops | Integer | Total number of stops in the route. |
routes | Array of Strings | List of all route addresses. |
totalDistanceKm | Float | Total distance of the route in kilometers. |
Code Exampleâ
Pythonâ
import requests
import json
url = "https://api.iapp.co.th/route-optimization"
payload = json.dumps({
"driverSize": -1,
"origin": {
"address": "āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ",
"latitude": 13.7882814,
"longitude": 100.5528693
},
"routes": [
{
"customerName": "Kobkrit Viriyayudhakorn",
"customerPhone": "0812345678",
"customerMail": "abc@google.com",
"customerAddress": "āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ 202/1 āļāļāļĒ āļāļīāļāļāļēāļĄāļĢāļ° 6 āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400",
"item": "Lanch box p23",
"instructionCC": "Next to Rachativee BTS station",
"instructionDriver": "Call me when arrive",
"latitude": 13.788463744195484,
"longitude": 100.5550741266538
},
{
"customerName": "Tanun C Lannon",
"customerPhone": "0890042785",
"customerMail": "def@google.com",
"customerAddress": "āļāļīāđāļāļāļĩ āļāļđāđāļāļāļĢāđāđāļāđāļāđāļāļāļĢāđ āļŠāļ°āļāļēāļāļāļ§āļēāļĒ 618 1 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400",
"item": "2 Box of Coffee",
"instructionCC": "",
"instructionDriver": ""
},
{
"customerName": "Johny",
"customerPhone": "0812345677",
"customerMail": "ghi@google.com",
"customerAddress": "Central Ladprao 1693 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900",
"item": "Letter",
"instructionCC": "Be careful",
"instructionDriver": ""
},
{
"customerName": "āļāļļāļāđāļāđāļ",
"customerPhone": "0876543212",
"customerAddress": "J.J Mall 588 āļāļāļ āļāļģāđāļāļāđāļāļāļĢ 2 āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900",
"item": "2 Cup of Golden Tomato Juice",
"instructionCC": "āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ",
"instructionDriver": "Call me when arrive",
"latitude": 13.80216676654782,
"longitude": 100.54899906898275
},
{
"customerName": "Umbrella corporation",
"customerPhone": "0142419514",
"customerAddress": "Future Park Rangsit 94 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āļāļģāļāļĨ āļāļĢāļ°āļāļēāļāļīāļāļąāļāļĒāđ āļāļģāđāļ āļāļāļąāļāļāļļāļĢāļĩ āļāļāļļāļĄāļāļēāļāļĩ 12130",
"item": "photo",
"instructionCC": "āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ",
"instructionDriver": "Call me when arrive",
"latitude": 13.989517181399442,
"longitude": 100.61792848432681
}
]
})
headers = {
'apikey': '{YOUR API KEY}',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
JavaScriptâ
const axios = require("axios")
let data = JSON.stringify({
driverSize: -1,
origin: {
address: "āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ",
latitude: 13.7882814,
longitude: 100.5528693,
},
routes: [
{
customerName: "Kobkrit Viriyayudhakorn",
customerPhone: "0812345678",
customerMail: "abc@google.com",
customerAddress: "āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ 202/1 āļāļāļĒ āļāļīāļāļāļēāļĄāļĢāļ° 6 āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400",
item: "Lanch box p23",
instructionCC: "Next to Rachativee BTS station",
instructionDriver: "Call me when arrive",
latitude: 13.788463744195484,
longitude: 100.5550741266538,
},
{
customerName: "Tanun C Lannon",
customerPhone: "0890042785",
customerMail: "def@google.com",
customerAddress: "āļāļīāđāļāļāļĩ āļāļđāđāļāļāļĢāđāđāļāđāļāđāļāļāļĢāđ āļŠāļ°āļāļēāļāļāļ§āļēāļĒ 618 1 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400",
item: "2 Box of Coffee",
instructionCC: "",
instructionDriver: "",
},
{
customerName: "Johny",
customerPhone: "0812345677",
customerMail: "ghi@google.com",
customerAddress: "Central Ladprao 1693 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900",
item: "Letter",
instructionCC: "Be careful",
instructionDriver: "",
},
{
customerName: "āļāļļāļāđāļāđāļ",
customerPhone: "0876543212",
customerAddress: "J.J Mall 588 āļāļāļ āļāļģāđāļāļāđāļāļāļĢ 2 āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900",
item: "2 Cup of Golden Tomato Juice",
instructionCC: "āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ",
instructionDriver: "Call me when arrive",
latitude: 13.80216676654782,
longitude: 100.54899906898275,
},
{
customerName: "Umbrella corporation",
customerPhone: "0142419514",
customerAddress: "Future Park Rangsit 94 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āļāļģāļāļĨ āļāļĢāļ°āļāļēāļāļīāļāļąāļāļĒāđ āļāļģāđāļ āļāļāļąāļāļāļļāļĢāļĩ āļāļāļļāļĄāļāļēāļāļĩ 12130",
item: "photo",
instructionCC: "āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ",
instructionDriver: "Call me when arrive",
latitude: 13.989517181399442,
longitude: 100.61792848432681,
},
],
})
let config = {
method: "post",
maxBodyLength: Infinity,
url: "https://api.iapp.co.th/route-optimization",
headers: {
apikey: "{YOUR API KEY}",
"Content-Type": "application/json",
},
data: data,
}
axios
.request(config)
.then((response) => {
console.log(JSON.stringify(response.data))
})
.catch((error) => {
console.log(error)
})
PHPâ
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.iapp.co.th/route-optimization',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"driverSize": -1,
"origin":{
"address":"āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ",
"latitude": 13.7882814,
"longitude": 100.5528693
},
"routes": [
{
"customerName": "Kobkrit Viriyayudhakorn",
"customerPhone": "0812345678",
"customerMail": "abc@google.com",
"customerAddress": "āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ 202/1 āļāļāļĒ āļāļīāļāļāļēāļĄāļĢāļ° 6 āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400",
"item": "Lanch box p23",
"instructionCC": "Next to Rachativee BTS station",
"instructionDriver": "Call me when arrive",
"latitude": 13.788463744195484,
"longitude": 100.5550741266538
},
{
"customerName": "Tanun C Lannon",
"customerPhone": "0890042785",
"customerMail": "def@google.com",
"customerAddress": "āļāļīāđāļāļāļĩ āļāļđāđāļāļāļĢāđāđāļāđāļāđāļāļāļĢāđ āļŠāļ°āļāļēāļāļāļ§āļēāļĒ 618 1 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400",
"item": "2 Box of Coffee",
"instructionCC": "",
"instructionDriver": ""
},
{
"customerName": "Johny",
"customerPhone": "0812345677",
"customerMail": "ghi@google.com",
"customerAddress": "Central Ladprao 1693 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900",
"item": "Letter",
"instructionCC": "Be careful",
"instructionDriver": ""
},
{
"customerName": "āļāļļāļāđāļāđāļ",
"customerPhone": "0876543212",
"customerAddress": "J.J Mall 588 āļāļāļ āļāļģāđāļāļāđāļāļāļĢ 2 āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900",
"item": "2 Cup of Golden Tomato Juice",
"instructionCC": "āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ",
"instructionDriver": "Call me when arrive",
"latitude": 13.80216676654782,
"longitude": 100.54899906898275
},
{
"customerName": "Umbrella corporation",
"customerPhone": "0142419514",
"customerAddress": "Future Park Rangsit 94 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āļāļģāļāļĨ āļāļĢāļ°āļāļēāļāļīāļāļąāļāļĒāđ āļāļģāđāļ āļāļāļąāļāļāļļāļĢāļĩ āļāļāļļāļĄāļāļēāļāļĩ 12130",
"item": "photo",
"instructionCC": "āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ",
"instructionDriver": "Call me when arrive",
"latitude": 13.989517181399443,
"longitude": 100.61792848432681
}
]
}',
CURLOPT_HTTPHEADER => array(
'apikey: {YOUR API KEY}',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Swiftâ
let parameters = "{\n\t\"driverSize\": -1,\n\t\"origin\":{\n\t\t\"address\":\"āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ\",\n\t\t\"latitude\": 13.7882814,\n\t\t\"longitude\": 100.5528693\n\t},\n\t\"routes\": [\n\t\t{\n\t\t\t\"customerName\": \"Kobkrit Viriyayudhakorn\",\n\t\t\t\"customerPhone\": \"0812345678\",\n\t\t\t\"customerMail\": \"abc@google.com\",\n\t\t\t\"customerAddress\": \"āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ 202/1 āļāļāļĒ āļāļīāļāļāļēāļĄāļĢāļ° 6 āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400\",\n\t\t\t\"item\": \"Lanch box p23\",\n\t\t\t\"instructionCC\": \"Next to Rachativee BTS station\",\n\t\t\t\"instructionDriver\": \"Call me when arrive\",\n\t\t\t\"latitude\": 13.788463744195484,\n\t\t\t\"longitude\": 100.5550741266538\n\t\t},\n\t\t{\n\t\t\t\"customerName\": \"Tanun C Lannon\",\n\t\t\t\"customerPhone\": \"0890042785\",\n\t\t\t\"customerMail\": \"def@google.com\",\n\t\t\t\"customerAddress\": \"āļāļīāđāļāļāļĩ āļāļđāđāļāļāļĢāđāđāļāđāļāđāļāļāļĢāđ āļŠāļ°āļāļēāļāļāļ§āļēāļĒ 618 1 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400\",\n\t\t\t\"item\": \"2 Box of Coffee\",\n\t\t\t\"instructionCC\": \"\",\n\t\t\t\"instructionDriver\": \"\"\n\t\t},\n\t\t{\n\t\t\t\"customerName\": \"Johny\",\n\t\t\t\"customerPhone\": \"0812345677\",\n\t\t\t\"customerMail\": \"ghi@google.com\",\n\t\t\t\"customerAddress\": \"Central Ladprao 1693 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900\",\n\t\t\t\"item\": \"Letter\",\n\t\t\t\"instructionCC\": \"Be careful\",\n\t\t\t\"instructionDriver\": \"\"\n\t\t},\n\t\t{\n\t\t\t\"customerName\": \"āļāļļāļāđāļāđāļ\",\n\t\t\t\"customerPhone\": \"0876543212\",\n\t\t\t\"customerAddress\": \"J.J Mall 588 āļāļāļ āļāļģāđāļāļāđāļāļāļĢ 2 āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900\",\n\t\t\t\"item\": \"2 Cup of Golden Tomato Juice\",\n\t\t\t\"instructionCC\": \"āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ\",\n\t\t\t\"instructionDriver\": \"Call me when arrive\",\n\t\t\t\"latitude\": 13.80216676654782,\n\t\t\t\"longitude\": 100.54899906898275\n\t\t},\n\t\t{\n\t\t\t\"customerName\": \"Umbrella corporation\",\n\t\t\t\"customerPhone\": \"0142419514\",\n\t\t\t\"customerAddress\": \"Future Park Rangsit 94 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āļāļģāļāļĨ āļāļĢāļ°āļāļēāļāļīāļāļąāļāļĒāđ āļāļģāđāļ āļāļāļąāļāļāļļāļĢāļĩ āļāļāļļāļĄāļāļēāļāļĩ 12130\",\n\t\t\t\"item\": \"photo\",\n\t\t\t\"instructionCC\": \"āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ\",\n\t\t\t\"instructionDriver\": \"Call me when arrive\",\n\t\t\t\"latitude\": 13.989517181399443,\n\t\t\t\"longitude\": 100.61792848432681\n\t\t}\n\t]\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.iapp.co.th/route-optimization")!,timeoutInterval: Double.infinity)
request.addValue("{YOUR API KEY}", forHTTPHeaderField: "apikey")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
Kotlinâ
val client = OkHttpClient()
val mediaType = "application/json".toMediaType()
val body = "{\n\t\"driverSize\": -1,\n\t\"origin\":{\n\t\t\"address\":\"āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ\",\n\t\t\"latitude\": 13.7882814,\n\t\t\"longitude\": 100.5528693\n\t},\n\t\"routes\": [\n\t\t{\n\t\t\t\"customerName\": \"Kobkrit Viriyayudhakorn\",\n\t\t\t\"customerPhone\": \"0812345678\",\n\t\t\t\"customerMail\": \"abc@google.com\",\n\t\t\t\"customerAddress\": \"āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ 202/1 āļāļāļĒ āļāļīāļāļāļēāļĄāļĢāļ° 6 āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400\",\n\t\t\t\"item\": \"Lanch box p23\",\n\t\t\t\"instructionCC\": \"Next to Rachativee BTS station\",\n\t\t\t\"instructionDriver\": \"Call me when arrive\",\n\t\t\t\"latitude\": 13.788463744195484,\n\t\t\t\"longitude\": 100.5550741266538\n\t\t},\n\t\t{\n\t\t\t\"customerName\": \"Tanun C Lannon\",\n\t\t\t\"customerPhone\": \"0890042785\",\n\t\t\t\"customerMail\": \"def@google.com\",\n\t\t\t\"customerAddress\": \"āļāļīāđāļāļāļĩ āļāļđāđāļāļāļĢāđāđāļāđāļāđāļāļāļĢāđ āļŠāļ°āļāļēāļāļāļ§āļēāļĒ 618 1 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400\",\n\t\t\t\"item\": \"2 Box of Coffee\",\n\t\t\t\"instructionCC\": \"\",\n\t\t\t\"instructionDriver\": \"\"\n\t\t},\n\t\t{\n\t\t\t\"customerName\": \"Johny\",\n\t\t\t\"customerPhone\": \"0812345677\",\n\t\t\t\"customerMail\": \"ghi@google.com\",\n\t\t\t\"customerAddress\": \"Central Ladprao 1693 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900\",\n\t\t\t\"item\": \"Letter\",\n\t\t\t\"instructionCC\": \"Be careful\",\n\t\t\t\"instructionDriver\": \"\"\n\t\t},\n\t\t{\n\t\t\t\"customerName\": \"āļāļļāļāđāļāđāļ\",\n\t\t\t\"customerPhone\": \"0876543212\",\n\t\t\t\"customerAddress\": \"J.J Mall 588 āļāļāļ āļāļģāđāļāļāđāļāļāļĢ 2 āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900\",\n\t\t\t\"item\": \"2 Cup of Golden Tomato Juice\",\n\t\t\t\"instructionCC\": \"āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ\",\n\t\t\t\"instructionDriver\": \"Call me when arrive\",\n\t\t\t\"latitude\": 13.80216676654782,\n\t\t\t\"longitude\": 100.54899906898275\n\t\t},\n\t\t{\n\t\t\t\"customerName\": \"Umbrella corporation\",\n\t\t\t\"customerPhone\": \"0142419514\",\n\t\t\t\"customerAddress\": \"Future Park Rangsit 94 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āļāļģāļāļĨ āļāļĢāļ°āļāļēāļāļīāļāļąāļāļĒāđ āļāļģāđāļ āļāļāļąāļāļāļļāļĢāļĩ āļāļāļļāļĄāļāļēāļāļĩ 12130\",\n\t\t\t\"item\": \"photo\",\n\t\t\t\"instructionCC\": \"āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ\",\n\t\t\t\"instructionDriver\": \"Call me when arrive\",\n\t\t\t\"latitude\": 13.989517181399443,\n\t\t\t\"longitude\": 100.61792848432681\n\t\t}\n\t]\n}".toRequestBody(mediaType)
val request = Request.Builder()
.url("https://api.iapp.co.th/route-optimization")
.post(body)
.addHeader("apikey", "{YOUR API KEY}")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()
Javaâ
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"driverSize\": -1,\n\t\"origin\":{\n\t\t\"address\":\"āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ\",\n\t\t\"latitude\": 13.7882814,\n\t\t\"longitude\": 100.5528693\n\t},\n\t\"routes\": [\n\t\t{\n\t\t\t\"customerName\": \"Kobkrit Viriyayudhakorn\",\n\t\t\t\"customerPhone\": \"0812345678\",\n\t\t\t\"customerMail\": \"abc@google.com\",\n\t\t\t\"customerAddress\": \"āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ 202/1 āļāļāļĒ āļāļīāļāļāļēāļĄāļĢāļ° 6 āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400\",\n\t\t\t\"item\": \"Lanch box p23\",\n\t\t\t\"instructionCC\": \"Next to Rachativee BTS station\",\n\t\t\t\"instructionDriver\": \"Call me when arrive\",\n\t\t\t\"latitude\": 13.788463744195484,\n\t\t\t\"longitude\": 100.5550741266538\n\t\t},\n\t\t{\n\t\t\t\"customerName\": \"Tanun C Lannon\",\n\t\t\t\"customerPhone\": \"0890042785\",\n\t\t\t\"customerMail\": \"def@google.com\",\n\t\t\t\"customerAddress\": \"āļāļīāđāļāļāļĩ āļāļđāđāļāļāļĢāđāđāļāđāļāđāļāļāļĢāđ āļŠāļ°āļāļēāļāļāļ§āļēāļĒ 618 1 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400\",\n\t\t\t\"item\": \"2 Box of Coffee\",\n\t\t\t\"instructionCC\": \"\",\n\t\t\t\"instructionDriver\": \"\"\n\t\t},\n\t\t{\n\t\t\t\"customerName\": \"Johny\",\n\t\t\t\"customerPhone\": \"0812345677\",\n\t\t\t\"customerMail\": \"ghi@google.com\",\n\t\t\t\"customerAddress\": \"Central Ladprao 1693 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900\",\n\t\t\t\"item\": \"Letter\",\n\t\t\t\"instructionCC\": \"Be careful\",\n\t\t\t\"instructionDriver\": \"\"\n\t\t},\n\t\t{\n\t\t\t\"customerName\": \"āļāļļāļāđāļāđāļ\",\n\t\t\t\"customerPhone\": \"0876543212\",\n\t\t\t\"customerAddress\": \"J.J Mall 588 āļāļāļ āļāļģāđāļāļāđāļāļāļĢ 2 āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900\",\n\t\t\t\"item\": \"2 Cup of Golden Tomato Juice\",\n\t\t\t\"instructionCC\": \"āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ\",\n\t\t\t\"instructionDriver\": \"Call me when arrive\",\n\t\t\t\"latitude\": 13.80216676654782,\n\t\t\t\"longitude\": 100.54899906898275\n\t\t},\n\t\t{\n\t\t\t\"customerName\": \"Umbrella corporation\",\n\t\t\t\"customerPhone\": \"0142419514\",\n\t\t\t\"customerAddress\": \"Future Park Rangsit 94 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āļāļģāļāļĨ āļāļĢāļ°āļāļēāļāļīāļāļąāļāļĒāđ āļāļģāđāļ āļāļāļąāļāļāļļāļĢāļĩ āļāļāļļāļĄāļāļēāļāļĩ 12130\",\n\t\t\t\"item\": \"photo\",\n\t\t\t\"instructionCC\": \"āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ\",\n\t\t\t\"instructionDriver\": \"Call me when arrive\",\n\t\t\t\"latitude\": 13.989517181399443,\n\t\t\t\"longitude\": 100.61792848432681\n\t\t}\n\t]\n}");
Request request = new Request.Builder()
.url("https://api.iapp.co.th/route-optimization")
.method("POST", body)
.addHeader("apikey", "{YOUR API KEY}")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Dartâ
var headers = {
'apikey': '{YOUR API KEY}',
'Content-Type': 'application/json'
};
var request = http.Request('POST', Uri.parse('https://api.iapp.co.th/route-optimization'));
request.body = json.encode({
"driverSize": -1,
"origin": {
"address": "āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ",
"latitude": 13.7882814,
"longitude": 100.5528693
},
"routes": [
{
"customerName": "Kobkrit Viriyayudhakorn",
"customerPhone": "0812345678",
"customerMail": "abc@google.com",
"customerAddress": "āļāļāļ. āļŠāļāļĩāļāļĩāđ āđāļāļāđāļāđāļ āđāļāđāļāļāđāđāļāļĢāļŠ 202/1 āļāļāļĒ āļāļīāļāļāļēāļĄāļĢāļ° 6 āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400",
"item": "Lanch box p23",
"instructionCC": "Next to Rachativee BTS station",
"instructionDriver": "Call me when arrive",
"latitude": 13.788463744195484,
"longitude": 100.5550741266538
},
{
"customerName": "Tanun C Lannon",
"customerPhone": "0890042785",
"customerMail": "def@google.com",
"customerAddress": "āļāļīāđāļāļāļĩ āļāļđāđāļāļāļĢāđāđāļāđāļāđāļāļāļĢāđ āļŠāļ°āļāļēāļāļāļ§āļēāļĒ 618 1 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļŠāļēāļĄāđāļŠāļāđāļ āđāļāļāļāļāļēāđāļ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10400",
"item": "2 Box of Coffee",
"instructionCC": "",
"instructionDriver": ""
},
{
"customerName": "Johny",
"customerPhone": "0812345677",
"customerMail": "ghi@google.com",
"customerAddress": "Central Ladprao 1693 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900",
"item": "Letter",
"instructionCC": "Be careful",
"instructionDriver": ""
},
{
"customerName": "āļāļļāļāđāļāđāļ",
"customerPhone": "0876543212",
"customerAddress": "J.J Mall 588 āļāļāļ āļāļģāđāļāļāđāļāļāļĢ 2 āđāļāļ§āļ āļāļāļļāļāļąāļāļĢ āđāļāļāļāļāļļāļāļąāļāļĢ āļāļĢāļļāļāđāļāļāļĄāļŦāļēāļāļāļĢ 10900",
"item": "2 Cup of Golden Tomato Juice",
"instructionCC": "āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ",
"instructionDriver": "Call me when arrive",
"latitude": 13.80216676654782,
"longitude": 100.54899906898275
},
{
"customerName": "Umbrella corporation",
"customerPhone": "0142419514",
"customerAddress": "Future Park Rangsit 94 āļ. āļāļŦāļĨāđāļĒāļāļīāļ āļāļģāļāļĨ āļāļĢāļ°āļāļēāļāļīāļāļąāļāļĒāđ āļāļģāđāļ āļāļāļąāļāļāļļāļĢāļĩ āļāļāļļāļĄāļāļēāļāļĩ 12130",
"item": "photo",
"instructionCC": "āļāļēāļāđāļ§āđāļāļĩāđāļĢāļđāļāļāļąāđāļ",
"instructionDriver": "Call me when arrive",
"latitude": 13.989517181399442,
"longitude": 100.61792848432681
}
]
});
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
Pricingâ
AI API Service Name | IC Per Request | On-Premise |
---|---|---|
Automatic Route Optimization | 1 IC/Request | Contact |