Bulk create location history
curl --request POST \
--url https://apiweb.mile.app/api/v3/location-history/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"location_histories": [
{
"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/bulk"
payload = { "location_histories": [
{
"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({
location_histories: [
{
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/bulk', 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/bulk",
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([
'location_histories' => [
[
'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/bulk"
payload := strings.NewReader("{\n \"location_histories\": [\n {\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 }\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/location-history/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"location_histories\": [\n {\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 }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/location-history/bulk")
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 \"location_histories\": [\n {\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 }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": 2,
"failed": 0,
"tasks": [
{
"status": true,
"message": "Success",
"_id": "634e98098ce07d29474a7e22_example@mile.app_1675224349343"
},
{
"status": true,
"message": "Success",
"_id": "634e98098ce07d29474a7e22_example@mile.app_1675224349578"
}
]
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Location History
Bulk create location history
This API enables mobile devices to create multiple location history entries in bulk. This feature is particularly useful when users are in offline mode and need to store location data locally, syncing it with the server when they regain internet connectivity. The request body should contain a single field location_histories, which is a list of location history entries. Maximum Limit: You can submit a maximum of 1000 location history entries in a single request. Each entry is represented as an object with the following fields:
POST
/
location-history
/
bulk
Bulk create location history
curl --request POST \
--url https://apiweb.mile.app/api/v3/location-history/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"location_histories": [
{
"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/bulk"
payload = { "location_histories": [
{
"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({
location_histories: [
{
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/bulk', 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/bulk",
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([
'location_histories' => [
[
'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/bulk"
payload := strings.NewReader("{\n \"location_histories\": [\n {\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 }\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/location-history/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"location_histories\": [\n {\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 }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/location-history/bulk")
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 \"location_histories\": [\n {\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 }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": 2,
"failed": 0,
"tasks": [
{
"status": true,
"message": "Success",
"_id": "634e98098ce07d29474a7e22_example@mile.app_1675224349343"
},
{
"status": true,
"message": "Success",
"_id": "634e98098ce07d29474a7e22_example@mile.app_1675224349578"
}
]
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}