Skip to main content

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

1 ICāļ•āđˆāļ­āļ„āļģāļ‚āļ­
v1.0 Active POST /v3/store/smart-city/automatic-route-optimization

āļĒāļīāļ™āļ”āļĩāļ•āđ‰āļ­āļ™āļĢāļąāļšāļŠāļđāđˆ Automatic Route Optimization API āđ€āļ§āļ­āļĢāđŒāļŠāļąāļ™ 1.0 āļœāļĨāļīāļ•āļ āļąāļ“āļ‘āđŒ AI āļ—āļĩāđˆāļžāļąāļ’āļ™āļēāđ‚āļ”āļĒ āļšāļĢāļīāļĐāļąāļ— āđ„āļ­āđāļ­āļžāļžāđŒāđ€āļ—āļ„āđ‚āļ™āđ‚āļĨāļĒāļĩ āļˆāļģāļāļąāļ” API āļ‚āļ­āļ‡āđ€āļĢāļēāļŠāđˆāļ§āļĒāđ€āļžāļīāđˆāļĄāļ›āļĢāļ°āļŠāļīāļ—āļ˜āļīāļ āļēāļžāđ€āļŠāđ‰āļ™āļ—āļēāļ‡āļāļēāļĢāļˆāļąāļ”āļŠāđˆāļ‡āđ‚āļ”āļĒāļāļēāļĢāļ„āđ‰āļ™āļŦāļēāđ€āļŠāđ‰āļ™āļ—āļēāļ‡āļ—āļĩāđˆāļĄāļĩāļ›āļĢāļ°āļŠāļīāļ—āļ˜āļīāļ āļēāļžāļ—āļĩāđˆāļŠāļļāļ”āļĢāļ°āļŦāļ§āđˆāļēāļ‡āļ›āļĨāļēāļĒāļ—āļēāļ‡āļŦāļĨāļēāļĒāđāļŦāđˆāļ‡ āđ‚āļ”āļĒāļ„āļģāļ™āļķāļ‡āļ–āļķāļ‡āļ‚āđ‰āļ­āļˆāļģāļāļąāļ”āļ•āđˆāļēāļ‡āđ† āđ€āļŠāđˆāļ™ āļ„āļ§āļēāļĄāļˆāļļāļ‚āļ­āļ‡āļĒāļēāļ™āļžāļēāļŦāļ™āļ° āļŠāđˆāļ§āļ‡āđ€āļ§āļĨāļē āđāļĨāļ°āļŠāļ āļēāļžāļāļēāļĢāļˆāļĢāļēāļˆāļĢ

āļ•āļąāļ§āļ­āļĒāđˆāļēāļ‡â€‹

āļĨāļ­āļ‡āđƒāļŠāđ‰āļ•āļąāļ§āļ­āļĒāđˆāļēāļ‡āđāļšāļšāđ‚āļ•āđ‰āļ•āļ­āļšāļ‚āļ­āļ‡āđ€āļĢāļēāđ€āļžāļ·āđˆāļ­āļ”āļđ Automatic Route Optimization API āđƒāļ™āļāļēāļĢāļ—āļģāļ‡āļēāļ™:

📈 Automatic Route Optimization Demo

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

Configuration / āļāļēāļĢāļ•āļąāđ‰āļ‡āļ„āđˆāļē

ðŸ’Ą Driver size determines how many drivers are available for route optimization.

Origin / āļˆāļļāļ”āđ€āļĢāļīāđˆāļĄāļ•āđ‰āļ™

Routes / āđ€āļŠāđ‰āļ™āļ—āļēāļ‡āļŠāđˆāļ‡āļ‚āļ­āļ‡

Route 1

āđ€āļĢāļīāđˆāļĄāļ•āđ‰āļ™āđƒāļŠāđ‰āļ‡āļēāļ™â€‹

  1. āļ‚āđ‰āļ­āļāļģāļŦāļ™āļ”āđ€āļšāļ·āđ‰āļ­āļ‡āļ•āđ‰āļ™

    • āļ„āļĩāļĒāđŒ API āļˆāļēāļ āđ„āļ­āđāļ­āļžāļžāđŒāđ€āļ—āļ„āđ‚āļ™āđ‚āļĨāļĒāļĩ
    • āļĢāļēāļĒāļŠāļ·āđˆāļ­āļŠāļ–āļēāļ™āļ—āļĩāđˆāļˆāļąāļ”āļŠāđˆāļ‡āļžāļĢāđ‰āļ­āļĄāļžāļīāļāļąāļ”
    • āļ‚āđ‰āļ­āļˆāļģāļāļąāļ”āļ‚āļ­āļ‡āļĒāļēāļ™āļžāļēāļŦāļ™āļ°āđāļĨāļ°āļāļēāļĢāļˆāļąāļ”āļŠāđˆāļ‡
    • āļˆāļģāļ™āļ§āļ™āļŠāļ–āļēāļ™āļ—āļĩāđˆāļŠāļđāļ‡āļŠāļļāļ”āļ•āđˆāļ­āļ„āļģāļ‚āļ­: 100
  2. āđ€āļĢāļīāđˆāļĄāļ•āđ‰āļ™āļ­āļĒāđˆāļēāļ‡āļĢāļ§āļ”āđ€āļĢāđ‡āļ§

    • āļāļēāļĢāļ„āļģāļ™āļ§āļ“āđ€āļŠāđ‰āļ™āļ—āļēāļ‡āļ—āļĩāđˆāļĢāļ§āļ”āđ€āļĢāđ‡āļ§
    • āļāļēāļĢāļžāļīāļˆāļēāļĢāļ“āļēāļŠāļ āļēāļžāļāļēāļĢāļˆāļĢāļēāļˆāļĢāđāļšāļšāđ€āļĢāļĩāļĒāļĨāđ„āļ—āļĄāđŒ
    • āļĢāļ­āļ‡āļĢāļąāļšāļĒāļēāļ™āļžāļēāļŦāļ™āļ°āļŦāļĨāļēāļĒāļ„āļąāļ™
    • āļāļēāļĢāđ€āļžāļīāđˆāļĄāļ›āļĢāļ°āļŠāļīāļ—āļ˜āļīāļ āļēāļžāļ•āļēāļĄāļ‚āđ‰āļ­āļˆāļģāļāļąāļ”
  3. āļ„āļļāļ“āļŠāļĄāļšāļąāļ•āļīāļŦāļĨāļąāļ

    • āļāļēāļĢāļˆāļąāļ”āđ€āļŠāđ‰āļ™āļ—āļēāļ‡āđāļšāļšāļŦāļĨāļēāļĒāļˆāļļāļ”āļ—āļĩāđˆāđ€āļžāļīāđˆāļĄāļ›āļĢāļ°āļŠāļīāļ—āļ˜āļīāļ āļēāļž
    • āļāļēāļĢāļ§āļēāļ‡āđāļœāļ™āļ„āļ§āļēāļĄāļˆāļļāļĒāļēāļ™āļžāļēāļŦāļ™āļ°
    • āļāļēāļĢāļāļģāļŦāļ™āļ”āđ€āļ§āļĨāļēāļ•āļēāļĄāļŠāđˆāļ§āļ‡āđ€āļ§āļĨāļē
    • āļāļēāļĢāļœāļŠāļēāļ™āļĢāļ§āļĄāļŠāļ āļēāļžāļāļēāļĢāļˆāļĢāļēāļˆāļĢāđāļšāļšāđ€āļĢāļĩāļĒāļĨāđ„āļ—āļĄāđŒ
    • āļĢāļ­āļ‡āļĢāļąāļšāļĒāļēāļ™āļžāļēāļŦāļ™āļ°āļŦāļĨāļēāļĒāļ„āļąāļ™
  4. āļ„āļ§āļēāļĄāļ›āļĨāļ­āļ”āļ āļąāļĒāđāļĨāļ°āļāļēāļĢāļ›āļāļīāļšāļąāļ•āļīāļ•āļēāļĄāļ‚āđ‰āļ­āļāļģāļŦāļ™āļ”

    • āđ€āļ›āđ‡āļ™āđ„āļ›āļ•āļēāļĄ GDPR āđāļĨāļ° PDPA
    • āļˆāļļāļ”āļŠāļīāđ‰āļ™āļŠāļļāļ” API āļ—āļĩāđˆāļ›āļĨāļ­āļ”āļ āļąāļĒ
    • āļāļēāļĢāđ€āļ‚āđ‰āļēāļĢāļŦāļąāļŠāļ‚āđ‰āļ­āļĄāļđāļĨāļĢāļ°āļŦāļ§āđˆāļēāļ‡āļāļēāļĢāļŠāđˆāļ‡

āļˆāļļāļ”āļŠāļīāđ‰āļ™āļŠāļļāļ” API​

āļˆāļļāļ”āļŠāļīāđ‰āļ™āļŠāļļāļ”āļ§āļīāļ˜āļĩāļāļēāļĢāļ„āļģāļ­āļ˜āļīāļšāļēāļĒāļĢāļēāļ„āļē
/v3/store/smart-city/automatic-route-optimization
Legacy: /route-optimization
POSTāđ€āļžāļīāđˆāļĄāļ›āļĢāļ°āļŠāļīāļ—āļ˜āļīāļ āļēāļžāđ€āļŠāđ‰āļ™āļ—āļēāļ‡āļāļēāļĢāļˆāļąāļ”āļŠāđˆāļ‡āļŠāļģāļŦāļĢāļąāļšāļ›āļĨāļēāļĒāļ—āļēāļ‡āļŦāļĨāļēāļĒāđāļŦāđˆāļ‡1 IC āļ•āđˆāļ­āļ„āļģāļ‚āļ­

āļ„āļļāļ“āļŠāļĄāļšāļąāļ•āļīāđāļĨāļ°āļ„āļ§āļēāļĄāļŠāļēāļĄāļēāļĢāļ–​

āļ„āļļāļ“āļŠāļĄāļšāļąāļ•āļīāļŦāļĨāļąāļâ€‹

Route Optimization API āļĄāļ­āļšāļ§āļīāļ˜āļĩāļāļēāļĢāļ—āļĩāđˆāļĄāļĩāļ›āļĢāļ°āļŠāļīāļ—āļ˜āļīāļ āļēāļžāđƒāļ™āļāļēāļĢāļ§āļēāļ‡āđāļœāļ™āđāļĨāļ°āđ€āļžāļīāđˆāļĄāļ›āļĢāļ°āļŠāļīāļ—āļ˜āļīāļ āļēāļžāđ€āļŠāđ‰āļ™āļ—āļēāļ‡āļāļēāļĢāļˆāļąāļ”āļŠāđˆāļ‡ āļ”āđ‰āļēāļ™āļĨāđˆāļēāļ‡āļ™āļĩāđ‰āļ„āļ·āļ­āļŠāļĢāļļāļ›āļ„āļļāļ“āļŠāļĄāļšāļąāļ•āļīāļŦāļĨāļąāļ:

  • āļāļēāļĢāļ§āļēāļ‡āđāļœāļ™āđ€āļŠāđ‰āļ™āļ—āļēāļ‡

    • āļ›āļĢāļąāļšāđ€āļŠāđ‰āļ™āļ—āļēāļ‡āļ­āļąāļ•āđ‚āļ™āļĄāļąāļ•āļīāđ‚āļ”āļĒāļ­āļīāļ‡āļ•āļēāļĄāļ•āđ‰āļ™āļ—āļēāļ‡āđāļĨāļ°āļ›āļĨāļēāļĒāļ—āļēāļ‡
    • āļ„āļģāļ™āļ§āļ“āđ€āļŠāđ‰āļ™āļ—āļēāļ‡āļ—āļĩāđˆāļŠāļąāđ‰āļ™āļ—āļĩāđˆāļŠāļļāļ”āđ€āļ—āđˆāļēāļ—āļĩāđˆāļˆāļ°āđ€āļ›āđ‡āļ™āđ„āļ›āđ„āļ”āđ‰ āļĨāļ”āļāļēāļĢāļŠāļīāđ‰āļ™āđ€āļ›āļĨāļ·āļ­āļ‡āđ€āļŠāļ·āđ‰āļ­āđ€āļžāļĨāļīāļ‡āđāļĨāļ°āđ€āļ§āļĨāļēāđ€āļ”āļīāļ™āļ—āļēāļ‡
  • āļāļēāļĢāļˆāļąāļ”āļāļēāļĢāļ„āļ™āļ‚āļąāļš

    • āļĢāļ­āļ‡āļĢāļąāļšāļāļēāļĢāļĄāļ­āļšāļŦāļĄāļēāļĒāļ„āļ™āļ‚āļąāļšāļŦāļĨāļēāļĒāļ„āļ™āļŠāļģāļŦāļĢāļąāļšāļāļēāļĢāļ”āļģāđ€āļ™āļīāļ™āļāļēāļĢāļˆāļąāļ”āļŠāđˆāļ‡āļ‚āļ™āļēāļ”āđƒāļŦāļāđˆ
    • āļāļēāļĢāļ›āļĢāļąāļšāđ€āļŠāđ‰āļ™āļ—āļēāļ‡āđāļšāļšāđ„āļ”āļ™āļēāļĄāļīāļāļ•āļēāļĄāļˆāļģāļ™āļ§āļ™āļ„āļ™āļ‚āļąāļšāļ—āļĩāđˆāļžāļĢāđ‰āļ­āļĄāđƒāļŠāđ‰āļ‡āļēāļ™
  • āļĢāļēāļĒāļĨāļ°āđ€āļ­āļĩāļĒāļ”āļāļēāļĢāļˆāļąāļ”āļŠāđˆāļ‡āļ—āļĩāđˆāļ›āļĢāļąāļšāđāļ•āđˆāļ‡āđ„āļ”āđ‰

    • āļ­āļ™āļļāļāļēāļ•āđƒāļŦāđ‰āļĢāļ°āļšāļļāļ„āļģāđāļ™āļ°āļ™āļģāļāļēāļĢāļˆāļąāļ”āļŠāđˆāļ‡āļŠāļģāļŦāļĢāļąāļš:
      • āļ—āļĩāļĄāļšāļĢāļīāļāļēāļĢāļĨāļđāļāļ„āđ‰āļē (āđ€āļŠāđˆāļ™ āļŦāļĄāļēāļĒāđ€āļŦāļ•āļļāļŦāļĢāļ·āļ­āļ„āļģāđāļ™āļ°āļ™āļģāđƒāļ™āļāļēāļĢāļˆāļąāļ”āļāļēāļĢ)
      • āļ„āļ™āļ‚āļąāļš (āđ€āļŠāđˆāļ™ āļˆāļļāļ”āļŠāđˆāļ‡, āļ„āļģāđāļ™āļ°āļ™āļģāļāļēāļĢāđ‚āļ—āļĢ)
    • āļĢāļ­āļ‡āļĢāļąāļšāļāļēāļĢāļ›āđ‰āļ­āļ™āļ‚āđ‰āļ­āļĄāļđāļĨāđ‚āļ”āļĒāļĨāļ°āđ€āļ­āļĩāļĒāļ”āļŠāļģāļŦāļĢāļąāļšāđāļ•āđˆāļĨāļ°āļˆāļļāļ”āđāļ§āļ°āļžāļąāļāļāļēāļĢāļˆāļąāļ”āļŠāđˆāļ‡ āļĢāļ§āļĄāļ–āļķāļ‡:
      • āļŠāļ·āđˆāļ­āļœāļđāđ‰āļĢāļąāļš, āļŦāļĄāļēāļĒāđ€āļĨāļ‚āđ‚āļ—āļĢāļĻāļąāļžāļ—āđŒ, āļ­āļĩāđ€āļĄāļĨ āđāļĨāļ°āļ—āļĩāđˆāļ­āļĒāļđāđˆ
      • āļ„āļģāļ­āļ˜āļīāļšāļēāļĒāļŠāļīāļ™āļ„āđ‰āļēāļ—āļĩāđˆāļˆāļąāļ”āļŠāđˆāļ‡
  • āļāļēāļĢāļ„āļģāļ™āļ§āļ“āļĢāļ°āļĒāļ°āļ—āļēāļ‡

    • āđāļŠāļ”āļ‡āļĢāļ°āļĒāļ°āļ—āļēāļ‡āļĢāļ§āļĄ (āđ€āļ›āđ‡āļ™āļāļīāđ‚āļĨāđ€āļĄāļ•āļĢ) āļŠāļģāļŦāļĢāļąāļšāđ€āļŠāđ‰āļ™āļ—āļēāļ‡āļ—āļĩāđˆāļ›āļĢāļąāļšāđƒāļŦāđ‰āđ€āļŦāļĄāļēāļ°āļŠāļĄ
    • āļŠāđˆāļ§āļĒāđƒāļ™āļāļēāļĢāļ•āļīāļ”āļ•āļēāļĄāļ•āđ‰āļ™āļ—āļļāļ™āļāļēāļĢāļˆāļąāļ”āļŠāđˆāļ‡āđāļĨāļ°āļāļēāļĢāļ§āļēāļ‡āđāļœāļ™āđ‚āļĨāļˆāļīāļŠāļ•āļīāļāļŠāđŒāļ­āļĒāđˆāļēāļ‡āļĄāļĩāļ›āļĢāļ°āļŠāļīāļ—āļ˜āļīāļ āļēāļž

āļ•āļąāļ§āļ­āļĒāđˆāļēāļ‡āļ„āļģāļ‚āļ­â€‹

curl --location 'https://api.iapp.co.th/route-optimization' \
--header 'apikey: {YOUR API KEY}' \
--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"
}
]
}'

āļ•āļąāļ§āļ­āļĒāđˆāļēāļ‡āļāļēāļĢāļ•āļ­āļšāļāļĨāļąāļšâ€‹

{
"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​

āļˆāļļāļ”āļŠāļīāđ‰āļ™āļŠāļļāļ”​

POST https://api.iapp.co.th/route-optimization

āļžāļēāļĢāļēāļĄāļīāđ€āļ•āļ­āļĢāđŒāļ„āļģāļ‚āļ­â€‹

āļŠāđˆāļ§āļ™āļŦāļąāļ§ (Headers)

āļ„āļĩāļĒāđŒ (Key)āļˆāļģāđ€āļ›āđ‡āļ™ (Required)āļ„āļģāļ­āļ˜āļīāļšāļēāļĒ (Description)
apikeyāđƒāļŠāđˆāļ„āļĩāļĒāđŒ API āļŠāļģāļŦāļĢāļąāļšāļāļēāļĢāļĒāļ·āļ™āļĒāļąāļ™āļ•āļąāļ§āļ•āļ™
Content-TypeāđƒāļŠāđˆāļ•āđ‰āļ­āļ‡āļ•āļąāđ‰āļ‡āļ„āđˆāļēāđ€āļ›āđ‡āļ™ application/json

āđ€āļ™āļ·āđ‰āļ­āļŦāļē (Body) (JSON)

āļ„āļĩāļĒāđŒ (Key)āļ›āļĢāļ°āđ€āļ āļ— (Type)āļˆāļģāđ€āļ›āđ‡āļ™ (Required)āļ„āļģāļ­āļ˜āļīāļšāļēāļĒ (Description)
driverSizeIntegerāđƒāļŠāđˆāļˆāļģāļ™āļ§āļ™āļ„āļ™āļ‚āļąāļšāļ—āļĩāđˆāļžāļĢāđ‰āļ­āļĄāļŠāļģāļŦāļĢāļąāļšāļāļēāļĢāļˆāļąāļ”āļŠāđˆāļ‡ āđƒāļŠāđ‰ -1 āđ€āļžāļ·āđˆāļ­āđƒāļŦāđ‰āļĢāļ°āļšāļšāđ€āļžāļīāđˆāļĄāļ›āļĢāļ°āļŠāļīāļ—āļ˜āļīāļ āļēāļžāļ­āļąāļ•āđ‚āļ™āļĄāļąāļ•āļī
originObjectāđƒāļŠāđˆāļˆāļļāļ”āđ€āļĢāļīāđˆāļĄāļ•āđ‰āļ™āļ‚āļ­āļ‡āđ€āļŠāđ‰āļ™āļ—āļēāļ‡āļāļēāļĢāļˆāļąāļ”āļŠāđˆāļ‡
origin.addressStringāđƒāļŠāđˆāļ—āļĩāđˆāļ­āļĒāļđāđˆāļ‚āļ­āļ‡āļˆāļļāļ”āđ€āļĢāļīāđˆāļĄāļ•āđ‰āļ™
origin.latitudeFloatāđƒāļŠāđˆāļžāļīāļāļąāļ”āļĨāļ°āļ•āļīāļˆāļđāļ”āļ‚āļ­āļ‡āļˆāļļāļ”āđ€āļĢāļīāđˆāļĄāļ•āđ‰āļ™
origin.longitudeFloatāđƒāļŠāđˆāļžāļīāļāļąāļ”āļĨāļ­āļ‡āļˆāļīāļˆāļđāļ”āļ‚āļ­āļ‡āļˆāļļāļ”āđ€āļĢāļīāđˆāļĄāļ•āđ‰āļ™
routesArray of ObjectsāđƒāļŠāđˆāļĢāļēāļĒāļāļēāļĢāļ›āļĨāļēāļĒāļ—āļēāļ‡āļāļēāļĢāļˆāļąāļ”āļŠāđˆāļ‡
routes[].customerNameStringāđƒāļŠāđˆāļŠāļ·āđˆāļ­āļœāļđāđ‰āļĢāļąāļš
routes[].customerPhoneStringāđƒāļŠāđˆāļŦāļĄāļēāļĒāđ€āļĨāļ‚āđ‚āļ—āļĢāļĻāļąāļžāļ—āđŒāļ‚āļ­āļ‡āļœāļđāđ‰āļĢāļąāļš
routes[].customerMailStringāđ„āļĄāđˆāđƒāļŠāđˆāļ—āļĩāđˆāļ­āļĒāļđāđˆāļ­āļĩāđ€āļĄāļĨāļ‚āļ­āļ‡āļœāļđāđ‰āļĢāļąāļš
routes[].customerAddressStringāđƒāļŠāđˆāļ—āļĩāđˆāļ­āļĒāļđāđˆāļ‚āļ­āļ‡āļŠāļ–āļēāļ™āļ—āļĩāđˆāļˆāļąāļ”āļŠāđˆāļ‡
routes[].itemStringāđƒāļŠāđˆāļ„āļģāļ­āļ˜āļīāļšāļēāļĒāļ‚āļ­āļ‡āļŠāļīāļ™āļ„āđ‰āļēāļ—āļĩāđˆāļˆāļ°āļˆāļąāļ”āļŠāđˆāļ‡
routes[].instructionCCStringāđ„āļĄāđˆāđƒāļŠāđˆāļ„āļģāđāļ™āļ°āļ™āļģāļŠāļģāļŦāļĢāļąāļšāļ—āļĩāļĄāļšāļĢāļīāļāļēāļĢāļĨāļđāļāļ„āđ‰āļē
routes[].instructionDriverStringāđ„āļĄāđˆāđƒāļŠāđˆāļ„āļģāđāļ™āļ°āļ™āļģāļŠāļģāļŦāļĢāļąāļšāļ„āļ™āļ‚āļąāļšāļĢāļ–
routes[].latitudeFloatāđ„āļĄāđˆāđƒāļŠāđˆāļžāļīāļāļąāļ”āļĨāļ°āļ•āļīāļˆāļđāļ”āļ‚āļ­āļ‡āļ›āļĨāļēāļĒāļ—āļēāļ‡
routes[].longitudeFloatāđ„āļĄāđˆāđƒāļŠāđˆāļžāļīāļāļąāļ”āļĨāļ­āļ‡āļˆāļīāļˆāļđāļ”āļ‚āļ­āļ‡āļ›āļĨāļēāļĒāļ—āļēāļ‡

āļžāļēāļĢāļēāļĄāļīāđ€āļ•āļ­āļĢāđŒāļāļēāļĢāļ•āļ­āļšāļāļĨāļąāļšâ€‹

āļ„āļĩāļĒāđŒ (Key)āļ›āļĢāļ°āđ€āļ āļ— (Type)āļ„āļģāļ­āļ˜āļīāļšāļēāļĒ
jobsArray of ObjectsāļĢāļēāļĒāļĨāļ°āđ€āļ­āļĩāļĒāļ”āļ‡āļēāļ™āļˆāļąāļ”āļŠāđˆāļ‡āļĢāļ§āļĄāļ–āļķāļ‡āļ‚āđ‰āļ­āļĄāļđāļĨāļ›āļĨāļēāļĒāļ—āļēāļ‡
jobs[].customerNameStringāļŠāļ·āđˆāļ­āļœāļđāđ‰āļĢāļąāļš
jobs[].customerPhoneStringāļŦāļĄāļēāļĒāđ€āļĨāļ‚āđ‚āļ—āļĢāļĻāļąāļžāļ—āđŒāļœāļđāđ‰āļĢāļąāļš
jobs[].customerMailStringāļ­āļĩāđ€āļĄāļĨāļœāļđāđ‰āļĢāļąāļš (āļŦāļēāļāļĢāļ°āļšāļļ)
jobs[].customerAddressStringāļ—āļĩāđˆāļ­āļĒāļđāđˆāļŠāļ–āļēāļ™āļ—āļĩāđˆāļˆāļąāļ”āļŠāđˆāļ‡
jobs[].itemStringāļ„āļģāļ­āļ˜āļīāļšāļēāļĒāļŠāļīāļ™āļ„āđ‰āļēāļ—āļĩāđˆāļˆāļ°āļˆāļąāļ”āļŠāđˆāļ‡
jobs[].instructionCCStringāļ„āļģāđāļ™āļ°āļ™āļģāļŠāļģāļŦāļĢāļąāļšāļāđˆāļēāļĒāļšāļĢāļīāļāļēāļĢāļĨāļđāļāļ„āđ‰āļē
jobs[].instructionDriverStringāļ„āļģāđāļ™āļ°āļ™āļģāļŠāļģāļŦāļĢāļąāļšāļ„āļ™āļ‚āļąāļšāļĢāļ–
jobs[].latitudeFloatāļĨāļ°āļ•āļīāļˆāļđāļ”āļ‚āļ­āļ‡āļ›āļĨāļēāļĒāļ—āļēāļ‡
jobs[].longitudeFloatāļĨāļ­āļ‡āļˆāļīāļˆāļđāļ”āļ‚āļ­āļ‡āļ›āļĨāļēāļĒāļ—āļēāļ‡
numberOfDropsIntegerāļˆāļģāļ™āļ§āļ™āļˆāļļāļ”āđāļ§āļ°āļžāļąāļāļ—āļąāđ‰āļ‡āļŦāļĄāļ”āđƒāļ™āđ€āļŠāđ‰āļ™āļ—āļēāļ‡
routesArray of StringsāļĢāļēāļĒāļāļēāļĢāļ—āļĩāđˆāļ­āļĒāļđāđˆāļ—āļąāđ‰āļ‡āļŦāļĄāļ”āđƒāļ™āđ€āļŠāđ‰āļ™āļ—āļēāļ‡
totalDistanceKmFloatāļĢāļ°āļĒāļ°āļ—āļēāļ‡āļĢāļ§āļĄāļ‚āļ­āļ‡āđ€āļŠāđ‰āļ™āļ—āļēāļ‡āđ€āļ›āđ‡āļ™āļāļīāđ‚āļĨāđ€āļĄāļ•āļĢ

āļ•āļąāļ§āļ­āļĒāđˆāļēāļ‡āđ‚āļ„āđ‰āļ”​

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);
}

āļ•āļąāļ§āļ­āļĒāđˆāļēāļ‡āđ‚āļ„āđ‰āļ”​

Curl​

curl -X POST https://api.iapp.co.th/v3/store/smart-city/route-optimization \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"locations": [], "constraints": {}}'

Python​

import requests
import json

url = "https://api.iapp.co.th/v3/store/smart-city/route-optimization"
headers = {
"apikey": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {"locations": [], "constraints": {}}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())

JavaScript​

const axios = require("axios");

const config = {
method: "post",
url: "https://api.iapp.co.th/v3/store/smart-city/route-optimization",
headers: {
apikey: "YOUR_API_KEY",
"Content-Type": "application/json",
},
data: {"locations": [], "constraints": {}},
};

axios(config)
.then((response) => console.log(response.data))
.catch((error) => console.log(error));

PHP​

<?php
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.iapp.co.th/v3/store/smart-city/route-optimization',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => '{"locations": [], "constraints": {}}',
CURLOPT_HTTPHEADER => array(
'apikey: YOUR_API_KEY',
'Content-Type: application/json'
),
));

$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>

Swift​

import Foundation

let url = URL(string: "https://api.iapp.co.th/v3/store/smart-city/route-optimization")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("YOUR_API_KEY", forHTTPHeaderField: "apikey")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")

let jsonData = try! JSONSerialization.data(withJSONObject: {"locations": [], "constraints": {}})
request.httpBody = jsonData

let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8)!)
}
}
task.resume()

Kotlin​

import okhttp3.*
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody

val client = OkHttpClient()

val json = """
{"locations": [], "constraints": {}}
""".trimIndent()

val requestBody = json.toRequestBody("application/json".toMediaTypeOrNull())

val request = Request.Builder()
.url("https://api.iapp.co.th/v3/store/smart-city/route-optimization")
.addHeader("apikey", "YOUR_API_KEY")
.post(requestBody)
.build()

client.newCall(request).execute().use { response ->
println(response.body?.string())
}

Java​

import okhttp3.*;

OkHttpClient client = new OkHttpClient();

String json = "{"locations": [], "constraints": {}}";

RequestBody body = RequestBody.create(
MediaType.parse("application/json"),
json
);

Request request = new Request.Builder()
.url("https://api.iapp.co.th/v3/store/smart-city/route-optimization")
.addHeader("apikey", "YOUR_API_KEY")
.post(body)
.build();

try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}

Dart​

import 'package:http/http.dart' as http;
import 'dart:convert';

var headers = {
'apikey': 'YOUR_API_KEY',
'Content-Type': 'application/json'
};

var data = {"locations": [], "constraints": {}};

var response = await http.post(
Uri.parse('https://api.iapp.co.th/v3/store/smart-city/route-optimization'),
headers: headers,
body: jsonEncode(data)
);

print(response.body);

āļĢāļēāļ„āļē​

āļŠāļ·āđˆāļ­āļšāļĢāļīāļāļēāļĢ AI APIIC āļ•āđˆāļ­āļ„āļģāļ‚āļ­On-Premise
āļāļēāļĢāļˆāļąāļ”āđ€āļŠāđ‰āļ™āļ—āļēāļ‡āļāļēāļĢāļŠāđˆāļ‡āļŠāļīāļ™āļ„āđ‰āļēāļ­āļąāļˆāļ‰āļĢāļīāļĒāļ°1 IC/āļ„āļģāļ‚āļ­āļ•āļīāļ”āļ•āđˆāļ­