curl --request POST \
--url https://apiweb.mile.app/api/v3/location-history \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"lat": "<string>",
"lon": "<string>",
"taskId": "<string>",
"speed": 123,
"distance": 123,
"duration": 123,
"createdTime": "<string>",
"startTime": "<string>",
"finishTime": "<string>",
"notes": "<string>",
"createdFrom": "<string>",
"data": {}
}
'import requests
url = "https://apiweb.mile.app/api/v3/location-history"
payload = {
"email": "<string>",
"lat": "<string>",
"lon": "<string>",
"taskId": "<string>",
"speed": 123,
"distance": 123,
"duration": 123,
"createdTime": "<string>",
"startTime": "<string>",
"finishTime": "<string>",
"notes": "<string>",
"createdFrom": "<string>",
"data": {}
}
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({
email: '<string>',
lat: '<string>',
lon: '<string>',
taskId: '<string>',
speed: 123,
distance: 123,
duration: 123,
createdTime: '<string>',
startTime: '<string>',
finishTime: '<string>',
notes: '<string>',
createdFrom: '<string>',
data: {}
})
};
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 => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => '<string>',
'lat' => '<string>',
'lon' => '<string>',
'taskId' => '<string>',
'speed' => 123,
'distance' => 123,
'duration' => 123,
'createdTime' => '<string>',
'startTime' => '<string>',
'finishTime' => '<string>',
'notes' => '<string>',
'createdFrom' => '<string>',
'data' => [
]
]),
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\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"taskId\": \"<string>\",\n \"speed\": 123,\n \"distance\": 123,\n \"duration\": 123,\n \"createdTime\": \"<string>\",\n \"startTime\": \"<string>\",\n \"finishTime\": \"<string>\",\n \"notes\": \"<string>\",\n \"createdFrom\": \"<string>\",\n \"data\": {}\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/location-history")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"taskId\": \"<string>\",\n \"speed\": 123,\n \"distance\": 123,\n \"duration\": 123,\n \"createdTime\": \"<string>\",\n \"startTime\": \"<string>\",\n \"finishTime\": \"<string>\",\n \"notes\": \"<string>\",\n \"createdFrom\": \"<string>\",\n \"data\": {}\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::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"taskId\": \"<string>\",\n \"speed\": 123,\n \"distance\": 123,\n \"duration\": 123,\n \"createdTime\": \"<string>\",\n \"startTime\": \"<string>\",\n \"finishTime\": \"<string>\",\n \"notes\": \"<string>\",\n \"createdFrom\": \"<string>\",\n \"data\": {}\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"location_history": {
"email": "[email protected]",
"taskId": "634e98098ce69d29474a7e11",
"speed": 40,
"distance": 50,
"duration": 50,
"lat": -6.1771046,
"lon": 106.9240199,
"_id": "[email protected]_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": "Internal server error, please contact [email protected]."
}Create location history
Location history has three types of payloads:
General: This payload is sent without any specific business process. All payloads sent will be saved and can be visualized.
Start - Finish: This payload tracks a user’s movement, both during general online activity and while performing a specific task. The ‘Finish’ payload cannot be saved unless it is preceded by a ‘Start’ payload, and a new ‘Start’ payload cannot be saved until the previous one has been completed.
Custom Data: This payload is typically used by integrators. The API provides a ‘data’ key with an object data type. This key can store dynamic data according to user needs. For example, users can store data such as fuel levels, vehicle temperature, and more.
curl --request POST \
--url https://apiweb.mile.app/api/v3/location-history \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"lat": "<string>",
"lon": "<string>",
"taskId": "<string>",
"speed": 123,
"distance": 123,
"duration": 123,
"createdTime": "<string>",
"startTime": "<string>",
"finishTime": "<string>",
"notes": "<string>",
"createdFrom": "<string>",
"data": {}
}
'import requests
url = "https://apiweb.mile.app/api/v3/location-history"
payload = {
"email": "<string>",
"lat": "<string>",
"lon": "<string>",
"taskId": "<string>",
"speed": 123,
"distance": 123,
"duration": 123,
"createdTime": "<string>",
"startTime": "<string>",
"finishTime": "<string>",
"notes": "<string>",
"createdFrom": "<string>",
"data": {}
}
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({
email: '<string>',
lat: '<string>',
lon: '<string>',
taskId: '<string>',
speed: 123,
distance: 123,
duration: 123,
createdTime: '<string>',
startTime: '<string>',
finishTime: '<string>',
notes: '<string>',
createdFrom: '<string>',
data: {}
})
};
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 => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => '<string>',
'lat' => '<string>',
'lon' => '<string>',
'taskId' => '<string>',
'speed' => 123,
'distance' => 123,
'duration' => 123,
'createdTime' => '<string>',
'startTime' => '<string>',
'finishTime' => '<string>',
'notes' => '<string>',
'createdFrom' => '<string>',
'data' => [
]
]),
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\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"taskId\": \"<string>\",\n \"speed\": 123,\n \"distance\": 123,\n \"duration\": 123,\n \"createdTime\": \"<string>\",\n \"startTime\": \"<string>\",\n \"finishTime\": \"<string>\",\n \"notes\": \"<string>\",\n \"createdFrom\": \"<string>\",\n \"data\": {}\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/location-history")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"taskId\": \"<string>\",\n \"speed\": 123,\n \"distance\": 123,\n \"duration\": 123,\n \"createdTime\": \"<string>\",\n \"startTime\": \"<string>\",\n \"finishTime\": \"<string>\",\n \"notes\": \"<string>\",\n \"createdFrom\": \"<string>\",\n \"data\": {}\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::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"taskId\": \"<string>\",\n \"speed\": 123,\n \"distance\": 123,\n \"duration\": 123,\n \"createdTime\": \"<string>\",\n \"startTime\": \"<string>\",\n \"finishTime\": \"<string>\",\n \"notes\": \"<string>\",\n \"createdFrom\": \"<string>\",\n \"data\": {}\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"location_history": {
"email": "[email protected]",
"taskId": "634e98098ce69d29474a7e11",
"speed": 40,
"distance": 50,
"duration": 50,
"lat": -6.1771046,
"lon": 106.9240199,
"_id": "[email protected]_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": "Internal server error, please contact [email protected]."
}Body
Required, User's email assigned to the monitored task. Example: [email protected]
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: {'temperature': 31, 'anotherKey': 'anotherValue'}