curl --request PUT \
--url https://apiweb.mile.app/api/v3/location-history/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "example@mile.app",
"lat": -6.934837011379089,
"lon": 107.74135602107883,
"speed": 102,
"createdTime": "2023-07-07 16:00:10",
"distance": 10,
"duration": 1,
"createdFrom": "GPS",
"data": {
"temp": 31
},
"taskId": "",
"time": 1688720650331
}
'import requests
url = "https://apiweb.mile.app/api/v3/location-history/"
payload = {
"email": "example@mile.app",
"lat": -6.934837011379089,
"lon": 107.74135602107883,
"speed": 102,
"createdTime": "2023-07-07 16:00:10",
"distance": 10,
"duration": 1,
"createdFrom": "GPS",
"data": { "temp": 31 },
"taskId": "",
"time": 1688720650331
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'example@mile.app',
lat: -6.934837011379089,
lon: 107.74135602107883,
speed: 102,
createdTime: '2023-07-07 16:00:10',
distance: 10,
duration: 1,
createdFrom: 'GPS',
data: {temp: 31},
taskId: '',
time: 1688720650331
})
};
fetch('https://apiweb.mile.app/api/v3/location-history/', 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/location-history/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'example@mile.app',
'lat' => -6.934837011379089,
'lon' => 107.74135602107883,
'speed' => 102,
'createdTime' => '2023-07-07 16:00:10',
'distance' => 10,
'duration' => 1,
'createdFrom' => 'GPS',
'data' => [
'temp' => 31
],
'taskId' => '',
'time' => 1688720650331
]),
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/location-history/"
payload := strings.NewReader("{\n \"email\": \"example@mile.app\",\n \"lat\": -6.934837011379089,\n \"lon\": 107.74135602107883,\n \"speed\": 102,\n \"createdTime\": \"2023-07-07 16:00:10\",\n \"distance\": 10,\n \"duration\": 1,\n \"createdFrom\": \"GPS\",\n \"data\": {\n \"temp\": 31\n },\n \"taskId\": \"\",\n \"time\": 1688720650331\n}")
req, _ := http.NewRequest("PUT", 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.put("https://apiweb.mile.app/api/v3/location-history/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"example@mile.app\",\n \"lat\": -6.934837011379089,\n \"lon\": 107.74135602107883,\n \"speed\": 102,\n \"createdTime\": \"2023-07-07 16:00:10\",\n \"distance\": 10,\n \"duration\": 1,\n \"createdFrom\": \"GPS\",\n \"data\": {\n \"temp\": 31\n },\n \"taskId\": \"\",\n \"time\": 1688720650331\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/location-history/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"example@mile.app\",\n \"lat\": -6.934837011379089,\n \"lon\": 107.74135602107883,\n \"speed\": 102,\n \"createdTime\": \"2023-07-07 16:00:10\",\n \"distance\": 10,\n \"duration\": 1,\n \"createdFrom\": \"GPS\",\n \"data\": {\n \"temp\": 31\n },\n \"taskId\": \"\",\n \"time\": 1688720650331\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"location_history": {
"email": "example@mile.app",
"taskId": "634e98098ce69d29474a7e11",
"speed": 40,
"distance": 50,
"duration": 50,
"lat": -6.1771046,
"lon": 106.9240199,
"_id": "634e98098ce07d29474a7e22_example@mile.app_1675224349343",
"time": 1675224349343,
"organizationId": "634e98098ce07d29474a7e22",
"createdTime": "2022-10-07 03:00:58",
"updatedTime": "2022-10-07 04:00:58",
"data": {
"temperature": 31,
"anotherKey": "anotherValue"
}
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Update location history by email & createdTime
curl --request PUT \
--url https://apiweb.mile.app/api/v3/location-history/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "example@mile.app",
"lat": -6.934837011379089,
"lon": 107.74135602107883,
"speed": 102,
"createdTime": "2023-07-07 16:00:10",
"distance": 10,
"duration": 1,
"createdFrom": "GPS",
"data": {
"temp": 31
},
"taskId": "",
"time": 1688720650331
}
'import requests
url = "https://apiweb.mile.app/api/v3/location-history/"
payload = {
"email": "example@mile.app",
"lat": -6.934837011379089,
"lon": 107.74135602107883,
"speed": 102,
"createdTime": "2023-07-07 16:00:10",
"distance": 10,
"duration": 1,
"createdFrom": "GPS",
"data": { "temp": 31 },
"taskId": "",
"time": 1688720650331
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'example@mile.app',
lat: -6.934837011379089,
lon: 107.74135602107883,
speed: 102,
createdTime: '2023-07-07 16:00:10',
distance: 10,
duration: 1,
createdFrom: 'GPS',
data: {temp: 31},
taskId: '',
time: 1688720650331
})
};
fetch('https://apiweb.mile.app/api/v3/location-history/', 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/location-history/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'example@mile.app',
'lat' => -6.934837011379089,
'lon' => 107.74135602107883,
'speed' => 102,
'createdTime' => '2023-07-07 16:00:10',
'distance' => 10,
'duration' => 1,
'createdFrom' => 'GPS',
'data' => [
'temp' => 31
],
'taskId' => '',
'time' => 1688720650331
]),
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/location-history/"
payload := strings.NewReader("{\n \"email\": \"example@mile.app\",\n \"lat\": -6.934837011379089,\n \"lon\": 107.74135602107883,\n \"speed\": 102,\n \"createdTime\": \"2023-07-07 16:00:10\",\n \"distance\": 10,\n \"duration\": 1,\n \"createdFrom\": \"GPS\",\n \"data\": {\n \"temp\": 31\n },\n \"taskId\": \"\",\n \"time\": 1688720650331\n}")
req, _ := http.NewRequest("PUT", 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.put("https://apiweb.mile.app/api/v3/location-history/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"example@mile.app\",\n \"lat\": -6.934837011379089,\n \"lon\": 107.74135602107883,\n \"speed\": 102,\n \"createdTime\": \"2023-07-07 16:00:10\",\n \"distance\": 10,\n \"duration\": 1,\n \"createdFrom\": \"GPS\",\n \"data\": {\n \"temp\": 31\n },\n \"taskId\": \"\",\n \"time\": 1688720650331\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/location-history/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"example@mile.app\",\n \"lat\": -6.934837011379089,\n \"lon\": 107.74135602107883,\n \"speed\": 102,\n \"createdTime\": \"2023-07-07 16:00:10\",\n \"distance\": 10,\n \"duration\": 1,\n \"createdFrom\": \"GPS\",\n \"data\": {\n \"temp\": 31\n },\n \"taskId\": \"\",\n \"time\": 1688720650331\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"location_history": {
"email": "example@mile.app",
"taskId": "634e98098ce69d29474a7e11",
"speed": 40,
"distance": 50,
"duration": 50,
"lat": -6.1771046,
"lon": 106.9240199,
"_id": "634e98098ce07d29474a7e22_example@mile.app_1675224349343",
"time": 1675224349343,
"organizationId": "634e98098ce07d29474a7e22",
"createdTime": "2022-10-07 03:00:58",
"updatedTime": "2022-10-07 04:00:58",
"data": {
"temperature": 31,
"anotherKey": "anotherValue"
}
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Authorizations
Use a valid Bearer token to authenticate.
Body
Required, User's email assigned to the monitored task. Example: example@mile.app
Required, Latitude coordinate position. Example: -6.934837011379089
Required, Longitude coordinate position. Example: 107.74135602107883
Unique ID to identify the task. Example: 634e98098ce69d29474a7e11
Vehicle speed in kilometers per hour. Example: 102
Distance traveled from the previous location. Example: 10
Time duration spent at this location in milliseconds. Example: 1
Source identifier for the location history entry. System-generated entries default to mileAppField, override this value when integrating a custom device or external source.
Example: GPS
Default: mileAppField
This is a free object that you can fill with any data in object format. Use it to store dynamic information that is not covered by the standard fields, such as fuel level or vehicle temperature. Any key you send is stored as-is and returned in the location history response. Example: {'temp': 31}