← Toutes les opérations
POST/v1/optimize

Trip optimisation (TSP)

Given an ordered list where the first point is origin, last is destination, and middle points are stops to visit in any order, returns the optimal stop sequence and the resulting route.

Corps de la requête

Schéma : OptimizeRequest

JSONExemple
{
  "locations": [
    {
      "lat": 5.3197,
      "lng": -4.0167
    },
    {
      "lat": 5.33,
      "lng": -4.01
    },
    {
      "lat": 5.348,
      "lng": -3.9904
    }
  ],
  "mode": "auto"
}

Réponses

  • 200Optimised trip.

Exemples de code

curl -X POST https://api.afrimap.ci/v1/optimize \
  -H "X-AfriMap-Key: $AFM_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "locations": [
      {"lat":5.3197,"lng":-4.0167},
      {"lat":5.3480,"lng":-3.9904},
      {"lat":5.3364,"lng":-4.0694},
      {"lat":5.3197,"lng":-4.0167}
    ],
    "mode": "auto"
  }'