curl --request PATCH \
--url https://apiweb.mile.app/api/v3/location-history/{loc_history_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "[email protected]",
"taskId": "634e98098ce69d29474a7e11",
"speed": 40,
"distance": 50,
"duration": 50,
"lat": -6.1771046,
"lon": 106.9240199
}
'import requests
url = "https://apiweb.mile.app/api/v3/location-history/{loc_history_id}"
payload = {
"email": "[email protected]",
"taskId": "634e98098ce69d29474a7e11",
"speed": 40,
"distance": 50,
"duration": 50,
"lat": -6.1771046,
"lon": 106.9240199
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '[email protected]',
taskId: '634e98098ce69d29474a7e11',
speed: 40,
distance: 50,
duration: 50,
lat: -6.1771046,
lon: 106.9240199
})
};
fetch('https://apiweb.mile.app/api/v3/location-history/{loc_history_id}', 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/{loc_history_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'email' => '[email protected]',
'taskId' => '634e98098ce69d29474a7e11',
'speed' => 40,
'distance' => 50,
'duration' => 50,
'lat' => -6.1771046,
'lon' => 106.9240199
]),
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/{loc_history_id}"
payload := strings.NewReader("{\n \"email\": \"[email protected]\",\n \"taskId\": \"634e98098ce69d29474a7e11\",\n \"speed\": 40,\n \"distance\": 50,\n \"duration\": 50,\n \"lat\": -6.1771046,\n \"lon\": 106.9240199\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://apiweb.mile.app/api/v3/location-history/{loc_history_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"[email protected]\",\n \"taskId\": \"634e98098ce69d29474a7e11\",\n \"speed\": 40,\n \"distance\": 50,\n \"duration\": 50,\n \"lat\": -6.1771046,\n \"lon\": 106.9240199\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/location-history/{loc_history_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"[email protected]\",\n \"taskId\": \"634e98098ce69d29474a7e11\",\n \"speed\": 40,\n \"distance\": 50,\n \"duration\": 50,\n \"lat\": -6.1771046,\n \"lon\": 106.9240199\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Data has been updated successfully.",
"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": "Data not found"
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Update partially location history by ID
curl --request PATCH \
--url https://apiweb.mile.app/api/v3/location-history/{loc_history_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "[email protected]",
"taskId": "634e98098ce69d29474a7e11",
"speed": 40,
"distance": 50,
"duration": 50,
"lat": -6.1771046,
"lon": 106.9240199
}
'import requests
url = "https://apiweb.mile.app/api/v3/location-history/{loc_history_id}"
payload = {
"email": "[email protected]",
"taskId": "634e98098ce69d29474a7e11",
"speed": 40,
"distance": 50,
"duration": 50,
"lat": -6.1771046,
"lon": 106.9240199
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '[email protected]',
taskId: '634e98098ce69d29474a7e11',
speed: 40,
distance: 50,
duration: 50,
lat: -6.1771046,
lon: 106.9240199
})
};
fetch('https://apiweb.mile.app/api/v3/location-history/{loc_history_id}', 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/{loc_history_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'email' => '[email protected]',
'taskId' => '634e98098ce69d29474a7e11',
'speed' => 40,
'distance' => 50,
'duration' => 50,
'lat' => -6.1771046,
'lon' => 106.9240199
]),
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/{loc_history_id}"
payload := strings.NewReader("{\n \"email\": \"[email protected]\",\n \"taskId\": \"634e98098ce69d29474a7e11\",\n \"speed\": 40,\n \"distance\": 50,\n \"duration\": 50,\n \"lat\": -6.1771046,\n \"lon\": 106.9240199\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://apiweb.mile.app/api/v3/location-history/{loc_history_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"[email protected]\",\n \"taskId\": \"634e98098ce69d29474a7e11\",\n \"speed\": 40,\n \"distance\": 50,\n \"duration\": 50,\n \"lat\": -6.1771046,\n \"lon\": 106.9240199\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/location-history/{loc_history_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"[email protected]\",\n \"taskId\": \"634e98098ce69d29474a7e11\",\n \"speed\": 40,\n \"distance\": 50,\n \"duration\": 50,\n \"lat\": -6.1771046,\n \"lon\": 106.9240199\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Data has been updated successfully.",
"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": "Data not found"
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Authorizations
Use a valid Bearer token to authenticate.
Path Parameters
Body
Required, User's email assigned to the monitored task. Example: [email protected]
Required, Latitude coordinate position. Example: -6.1771046
Required, Longitude coordinate position. Example: 106.9240199
Unique ID to identify the task. Example: 634e98098ce69d29474a7e11
Vehicle speed in kilometers per hour. Example: 40
Distance traveled from the previous location. Example: 50
Time duration spent at this location in milliseconds. Example: 50
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'}