Skip to main content

📈 Automatic Route Optimization 🆕

📈 AI āļāļēāļĢāļˆāļąāļ”āđ€āļŠāđ‰āļ™āļ—āļēāļ‡āļāļēāļĢāļŠāđˆāļ‡āļŠāļīāļ™āļ„āđ‰āļēāļŦāļĨāļēāļĒāļˆāļļāļ”āļ­āļĒāđˆāļēāļ‡āļ­āļąāļˆāļ‰āļĢāļīāļĒāļ° 🆕

Version Status

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​

  1. Prerequisites

    • An API key from iApp Technology
    • List of delivery locations with coordinates
    • Vehicle and delivery constraints
    • Maximum locations per request: 100
  2. Quick Start

    • Fast route calculation
    • Real-time traffic consideration
    • Multiple vehicle support
    • Constraint-based optimization
  3. Key Features

    • Optimized multi-stop routing
    • Vehicle capacity planning
    • Time window scheduling
    • Real-time traffic integration
    • Multiple vehicle fleet support
  4. Security & Compliance

    • GDPR and PDPA compliant
    • Secure API endpoints
    • Data encryption in transit
How to get API Key?

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.
  • 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

KeyRequiredDescription
apikeyYesAPI key for authentication.
Content-TypeYesMust be set to application/json.

Body (JSON)

KeyTypeRequiredDescription
driverSizeIntegerYesThe number of drivers available for delivery. Use -1 for auto-optimize.
originObjectYesThe starting point of the delivery route.
origin.addressStringYesAddress of the origin.
origin.latitudeFloatYesLatitude coordinate of the origin.
origin.longitudeFloatYesLongitude coordinate of the origin.
routesArray of ObjectsYesList of delivery destinations.
routes[].customerNameStringYesName of the recipient.
routes[].customerPhoneStringYesPhone number of the recipient.
routes[].customerMailStringNoEmail address of the recipient.
routes[].customerAddressStringYesAddress of the delivery location.
routes[].itemStringYesDescription of the delivery item.
routes[].instructionCCStringNoInstructions for the customer care team.
routes[].instructionDriverStringNoInstructions for the delivery driver.
routes[].latitudeFloatNoLatitude coordinate of the destination.
routes[].longitudeFloatNoLongitude coordinate of the destination.

Response Parameters​

KeyTypeDescription
jobsArray of ObjectsDetails of the delivery jobs including destination info.
jobs[].customerNameStringName of the recipient.
jobs[].customerPhoneStringPhone number of the recipient.
jobs[].customerMailStringEmail of the recipient (if provided).
jobs[].customerAddressStringAddress of the delivery location.
jobs[].itemStringDescription of the delivery item.
jobs[].instructionCCStringInstructions for customer care.
jobs[].instructionDriverStringInstructions for the delivery driver.
jobs[].latitudeFloatLatitude of the destination.
jobs[].longitudeFloatLongitude of the destination.
numberOfDropsIntegerTotal number of stops in the route.
routesArray of StringsList of all route addresses.
totalDistanceKmFloatTotal 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 NameIC Per RequestOn-Premise
Automatic Route Optimization1 IC/RequestContact