Reorder visits
curl --request POST \
--url https://apiweb.mile.app/api/v3/reorder-visits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"currentCoordinate": "-7.76287840866215,113.24105028153643",
"visits": [
{
"id": "taskId-6865263cdbb431345b0b0a04",
"name": "Order 2",
"address": "Bangil",
"coordinate": "-7.5976243,112.7845343",
"timeWindow": {
"startTime": "07:00",
"endTime": "23:00"
},
"visitTime": "30"
},
{
"id": "taskId-6865263cdbb431345b0b0a02",
"name": "Order 1",
"address": "Probolinggo",
"coordinate": "-7.86316,113.30510534699638",
"timeWindow": {
"startTime": "07:00",
"endTime": "23:00"
},
"visitTime": "30"
}
]
}
'import requests
url = "https://apiweb.mile.app/api/v3/reorder-visits"
payload = {
"currentCoordinate": "-7.76287840866215,113.24105028153643",
"visits": [
{
"id": "taskId-6865263cdbb431345b0b0a04",
"name": "Order 2",
"address": "Bangil",
"coordinate": "-7.5976243,112.7845343",
"timeWindow": {
"startTime": "07:00",
"endTime": "23:00"
},
"visitTime": "30"
},
{
"id": "taskId-6865263cdbb431345b0b0a02",
"name": "Order 1",
"address": "Probolinggo",
"coordinate": "-7.86316,113.30510534699638",
"timeWindow": {
"startTime": "07:00",
"endTime": "23:00"
},
"visitTime": "30"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
currentCoordinate: '-7.76287840866215,113.24105028153643',
visits: [
{
id: 'taskId-6865263cdbb431345b0b0a04',
name: 'Order 2',
address: 'Bangil',
coordinate: '-7.5976243,112.7845343',
timeWindow: {startTime: '07:00', endTime: '23:00'},
visitTime: '30'
},
{
id: 'taskId-6865263cdbb431345b0b0a02',
name: 'Order 1',
address: 'Probolinggo',
coordinate: '-7.86316,113.30510534699638',
timeWindow: {startTime: '07:00', endTime: '23:00'},
visitTime: '30'
}
]
})
};
fetch('https://apiweb.mile.app/api/v3/reorder-visits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiweb.mile.app/api/v3/reorder-visits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'currentCoordinate' => '-7.76287840866215,113.24105028153643',
'visits' => [
[
'id' => 'taskId-6865263cdbb431345b0b0a04',
'name' => 'Order 2',
'address' => 'Bangil',
'coordinate' => '-7.5976243,112.7845343',
'timeWindow' => [
'startTime' => '07:00',
'endTime' => '23:00'
],
'visitTime' => '30'
],
[
'id' => 'taskId-6865263cdbb431345b0b0a02',
'name' => 'Order 1',
'address' => 'Probolinggo',
'coordinate' => '-7.86316,113.30510534699638',
'timeWindow' => [
'startTime' => '07:00',
'endTime' => '23:00'
],
'visitTime' => '30'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiweb.mile.app/api/v3/reorder-visits"
payload := strings.NewReader("{\n \"currentCoordinate\": \"-7.76287840866215,113.24105028153643\",\n \"visits\": [\n {\n \"id\": \"taskId-6865263cdbb431345b0b0a04\",\n \"name\": \"Order 2\",\n \"address\": \"Bangil\",\n \"coordinate\": \"-7.5976243,112.7845343\",\n \"timeWindow\": {\n \"startTime\": \"07:00\",\n \"endTime\": \"23:00\"\n },\n \"visitTime\": \"30\"\n },\n {\n \"id\": \"taskId-6865263cdbb431345b0b0a02\",\n \"name\": \"Order 1\",\n \"address\": \"Probolinggo\",\n \"coordinate\": \"-7.86316,113.30510534699638\",\n \"timeWindow\": {\n \"startTime\": \"07:00\",\n \"endTime\": \"23:00\"\n },\n \"visitTime\": \"30\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apiweb.mile.app/api/v3/reorder-visits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"currentCoordinate\": \"-7.76287840866215,113.24105028153643\",\n \"visits\": [\n {\n \"id\": \"taskId-6865263cdbb431345b0b0a04\",\n \"name\": \"Order 2\",\n \"address\": \"Bangil\",\n \"coordinate\": \"-7.5976243,112.7845343\",\n \"timeWindow\": {\n \"startTime\": \"07:00\",\n \"endTime\": \"23:00\"\n },\n \"visitTime\": \"30\"\n },\n {\n \"id\": \"taskId-6865263cdbb431345b0b0a02\",\n \"name\": \"Order 1\",\n \"address\": \"Probolinggo\",\n \"coordinate\": \"-7.86316,113.30510534699638\",\n \"timeWindow\": {\n \"startTime\": \"07:00\",\n \"endTime\": \"23:00\"\n },\n \"visitTime\": \"30\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/reorder-visits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currentCoordinate\": \"-7.76287840866215,113.24105028153643\",\n \"visits\": [\n {\n \"id\": \"taskId-6865263cdbb431345b0b0a04\",\n \"name\": \"Order 2\",\n \"address\": \"Bangil\",\n \"coordinate\": \"-7.5976243,112.7845343\",\n \"timeWindow\": {\n \"startTime\": \"07:00\",\n \"endTime\": \"23:00\"\n },\n \"visitTime\": \"30\"\n },\n {\n \"id\": \"taskId-6865263cdbb431345b0b0a02\",\n \"name\": \"Order 1\",\n \"address\": \"Probolinggo\",\n \"coordinate\": \"-7.86316,113.30510534699638\",\n \"timeWindow\": {\n \"startTime\": \"07:00\",\n \"endTime\": \"23:00\"\n },\n \"visitTime\": \"30\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"statusCode": 200,
"data": [
{
"status": true,
"message": "Success.",
"_id": "6865263cdbb431345b0b0a02",
"orderIndex": 17515144251
},
{
"status": true,
"message": "Success.",
"_id": "6865263cdbb431345b0b0a04",
"orderIndex": 17515144252
}
]
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Routing
Reorder visits
This API endpoint allows you to reorder a given list of visits based on the current coordinate, optimizing the sequence of the visits.
POST
/
reorder-visits
Reorder visits
curl --request POST \
--url https://apiweb.mile.app/api/v3/reorder-visits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"currentCoordinate": "-7.76287840866215,113.24105028153643",
"visits": [
{
"id": "taskId-6865263cdbb431345b0b0a04",
"name": "Order 2",
"address": "Bangil",
"coordinate": "-7.5976243,112.7845343",
"timeWindow": {
"startTime": "07:00",
"endTime": "23:00"
},
"visitTime": "30"
},
{
"id": "taskId-6865263cdbb431345b0b0a02",
"name": "Order 1",
"address": "Probolinggo",
"coordinate": "-7.86316,113.30510534699638",
"timeWindow": {
"startTime": "07:00",
"endTime": "23:00"
},
"visitTime": "30"
}
]
}
'import requests
url = "https://apiweb.mile.app/api/v3/reorder-visits"
payload = {
"currentCoordinate": "-7.76287840866215,113.24105028153643",
"visits": [
{
"id": "taskId-6865263cdbb431345b0b0a04",
"name": "Order 2",
"address": "Bangil",
"coordinate": "-7.5976243,112.7845343",
"timeWindow": {
"startTime": "07:00",
"endTime": "23:00"
},
"visitTime": "30"
},
{
"id": "taskId-6865263cdbb431345b0b0a02",
"name": "Order 1",
"address": "Probolinggo",
"coordinate": "-7.86316,113.30510534699638",
"timeWindow": {
"startTime": "07:00",
"endTime": "23:00"
},
"visitTime": "30"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
currentCoordinate: '-7.76287840866215,113.24105028153643',
visits: [
{
id: 'taskId-6865263cdbb431345b0b0a04',
name: 'Order 2',
address: 'Bangil',
coordinate: '-7.5976243,112.7845343',
timeWindow: {startTime: '07:00', endTime: '23:00'},
visitTime: '30'
},
{
id: 'taskId-6865263cdbb431345b0b0a02',
name: 'Order 1',
address: 'Probolinggo',
coordinate: '-7.86316,113.30510534699638',
timeWindow: {startTime: '07:00', endTime: '23:00'},
visitTime: '30'
}
]
})
};
fetch('https://apiweb.mile.app/api/v3/reorder-visits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiweb.mile.app/api/v3/reorder-visits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'currentCoordinate' => '-7.76287840866215,113.24105028153643',
'visits' => [
[
'id' => 'taskId-6865263cdbb431345b0b0a04',
'name' => 'Order 2',
'address' => 'Bangil',
'coordinate' => '-7.5976243,112.7845343',
'timeWindow' => [
'startTime' => '07:00',
'endTime' => '23:00'
],
'visitTime' => '30'
],
[
'id' => 'taskId-6865263cdbb431345b0b0a02',
'name' => 'Order 1',
'address' => 'Probolinggo',
'coordinate' => '-7.86316,113.30510534699638',
'timeWindow' => [
'startTime' => '07:00',
'endTime' => '23:00'
],
'visitTime' => '30'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiweb.mile.app/api/v3/reorder-visits"
payload := strings.NewReader("{\n \"currentCoordinate\": \"-7.76287840866215,113.24105028153643\",\n \"visits\": [\n {\n \"id\": \"taskId-6865263cdbb431345b0b0a04\",\n \"name\": \"Order 2\",\n \"address\": \"Bangil\",\n \"coordinate\": \"-7.5976243,112.7845343\",\n \"timeWindow\": {\n \"startTime\": \"07:00\",\n \"endTime\": \"23:00\"\n },\n \"visitTime\": \"30\"\n },\n {\n \"id\": \"taskId-6865263cdbb431345b0b0a02\",\n \"name\": \"Order 1\",\n \"address\": \"Probolinggo\",\n \"coordinate\": \"-7.86316,113.30510534699638\",\n \"timeWindow\": {\n \"startTime\": \"07:00\",\n \"endTime\": \"23:00\"\n },\n \"visitTime\": \"30\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apiweb.mile.app/api/v3/reorder-visits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"currentCoordinate\": \"-7.76287840866215,113.24105028153643\",\n \"visits\": [\n {\n \"id\": \"taskId-6865263cdbb431345b0b0a04\",\n \"name\": \"Order 2\",\n \"address\": \"Bangil\",\n \"coordinate\": \"-7.5976243,112.7845343\",\n \"timeWindow\": {\n \"startTime\": \"07:00\",\n \"endTime\": \"23:00\"\n },\n \"visitTime\": \"30\"\n },\n {\n \"id\": \"taskId-6865263cdbb431345b0b0a02\",\n \"name\": \"Order 1\",\n \"address\": \"Probolinggo\",\n \"coordinate\": \"-7.86316,113.30510534699638\",\n \"timeWindow\": {\n \"startTime\": \"07:00\",\n \"endTime\": \"23:00\"\n },\n \"visitTime\": \"30\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/reorder-visits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currentCoordinate\": \"-7.76287840866215,113.24105028153643\",\n \"visits\": [\n {\n \"id\": \"taskId-6865263cdbb431345b0b0a04\",\n \"name\": \"Order 2\",\n \"address\": \"Bangil\",\n \"coordinate\": \"-7.5976243,112.7845343\",\n \"timeWindow\": {\n \"startTime\": \"07:00\",\n \"endTime\": \"23:00\"\n },\n \"visitTime\": \"30\"\n },\n {\n \"id\": \"taskId-6865263cdbb431345b0b0a02\",\n \"name\": \"Order 1\",\n \"address\": \"Probolinggo\",\n \"coordinate\": \"-7.86316,113.30510534699638\",\n \"timeWindow\": {\n \"startTime\": \"07:00\",\n \"endTime\": \"23:00\"\n },\n \"visitTime\": \"30\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"statusCode": 200,
"data": [
{
"status": true,
"message": "Success.",
"_id": "6865263cdbb431345b0b0a02",
"orderIndex": 17515144251
},
{
"status": true,
"message": "Success.",
"_id": "6865263cdbb431345b0b0a04",
"orderIndex": 17515144252
}
]
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Authorizations
Use a valid Bearer token to authenticate.
Body
application/json
⌘I