curl --request PATCH \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"vehicle_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"distance": "<string>",
"trip_date": "2023-12-25",
"purpose": "BUSINESS",
"start_address": "<string>",
"end_address": "<string>",
"google_start_place_id": "<string>",
"google_end_place_id": "<string>",
"start_latitude": "<string>",
"start_longitude": "<string>",
"end_latitude": "<string>",
"end_longitude": "<string>",
"description": "<string>"
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId}"
payload = {
"vehicle_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"distance": "<string>",
"trip_date": "2023-12-25",
"purpose": "BUSINESS",
"start_address": "<string>",
"end_address": "<string>",
"google_start_place_id": "<string>",
"google_end_place_id": "<string>",
"start_latitude": "<string>",
"start_longitude": "<string>",
"end_latitude": "<string>",
"end_longitude": "<string>",
"description": "<string>"
}
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({
vehicle_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
external_id: '<string>',
distance: '<string>',
trip_date: '2023-12-25',
purpose: 'BUSINESS',
start_address: '<string>',
end_address: '<string>',
google_start_place_id: '<string>',
google_end_place_id: '<string>',
start_latitude: '<string>',
start_longitude: '<string>',
end_latitude: '<string>',
end_longitude: '<string>',
description: '<string>'
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId}', 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://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId}",
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([
'vehicle_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'external_id' => '<string>',
'distance' => '<string>',
'trip_date' => '2023-12-25',
'purpose' => 'BUSINESS',
'start_address' => '<string>',
'end_address' => '<string>',
'google_start_place_id' => '<string>',
'google_end_place_id' => '<string>',
'start_latitude' => '<string>',
'start_longitude' => '<string>',
'end_latitude' => '<string>',
'end_longitude' => '<string>',
'description' => '<string>'
]),
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://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId}"
payload := strings.NewReader("{\n \"vehicle_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\",\n \"distance\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"purpose\": \"BUSINESS\",\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"google_start_place_id\": \"<string>\",\n \"google_end_place_id\": \"<string>\",\n \"start_latitude\": \"<string>\",\n \"start_longitude\": \"<string>\",\n \"end_latitude\": \"<string>\",\n \"end_longitude\": \"<string>\",\n \"description\": \"<string>\"\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://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"vehicle_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\",\n \"distance\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"purpose\": \"BUSINESS\",\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"google_start_place_id\": \"<string>\",\n \"google_end_place_id\": \"<string>\",\n \"start_latitude\": \"<string>\",\n \"start_longitude\": \"<string>\",\n \"end_latitude\": \"<string>\",\n \"end_longitude\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId}")
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 \"vehicle_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\",\n \"distance\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"purpose\": \"BUSINESS\",\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"google_start_place_id\": \"<string>\",\n \"google_end_place_id\": \"<string>\",\n \"start_latitude\": \"<string>\",\n \"start_longitude\": \"<string>\",\n \"end_latitude\": \"<string>\",\n \"end_longitude\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vehicle": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"make_and_model": "<string>",
"year": 123,
"is_primary": true,
"is_eligible_for_deletion": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"type": "com.layerfi.routers.ApiVehicle",
"external_id": "<string>",
"license_plate": "<string>",
"vin": "<string>",
"description": "<string>",
"archived_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
},
"distance": "<string>",
"distance_source": "COMPUTED",
"trip_date": "2023-12-25",
"purpose": "BUSINESS",
"mileage_deduction_rate": "<string>",
"estimated_deduction": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"type": "com.layerfi.routers.ApiTrip",
"external_id": "<string>",
"start_address": "<string>",
"end_address": "<string>",
"google_start_place_id": "<string>",
"google_end_place_id": "<string>",
"start_latitude": "<string>",
"start_longitude": "<string>",
"end_latitude": "<string>",
"end_longitude": "<string>",
"description": "<string>",
"deleted_at": "2023-11-07T05:31:56Z"
}
}{
"type": "InvalidParameters",
"description": "<string>",
"error_enum": "InvalidPayload",
"meta": {}
}{
"type": "InvalidParameters",
"description": "<string>",
"error_enum": "InvalidPayload",
"meta": {}
}Update trip
Partially updates a trip. Only provided fields will be updated.
curl --request PATCH \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"vehicle_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"distance": "<string>",
"trip_date": "2023-12-25",
"purpose": "BUSINESS",
"start_address": "<string>",
"end_address": "<string>",
"google_start_place_id": "<string>",
"google_end_place_id": "<string>",
"start_latitude": "<string>",
"start_longitude": "<string>",
"end_latitude": "<string>",
"end_longitude": "<string>",
"description": "<string>"
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId}"
payload = {
"vehicle_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"distance": "<string>",
"trip_date": "2023-12-25",
"purpose": "BUSINESS",
"start_address": "<string>",
"end_address": "<string>",
"google_start_place_id": "<string>",
"google_end_place_id": "<string>",
"start_latitude": "<string>",
"start_longitude": "<string>",
"end_latitude": "<string>",
"end_longitude": "<string>",
"description": "<string>"
}
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({
vehicle_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
external_id: '<string>',
distance: '<string>',
trip_date: '2023-12-25',
purpose: 'BUSINESS',
start_address: '<string>',
end_address: '<string>',
google_start_place_id: '<string>',
google_end_place_id: '<string>',
start_latitude: '<string>',
start_longitude: '<string>',
end_latitude: '<string>',
end_longitude: '<string>',
description: '<string>'
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId}', 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://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId}",
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([
'vehicle_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'external_id' => '<string>',
'distance' => '<string>',
'trip_date' => '2023-12-25',
'purpose' => 'BUSINESS',
'start_address' => '<string>',
'end_address' => '<string>',
'google_start_place_id' => '<string>',
'google_end_place_id' => '<string>',
'start_latitude' => '<string>',
'start_longitude' => '<string>',
'end_latitude' => '<string>',
'end_longitude' => '<string>',
'description' => '<string>'
]),
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://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId}"
payload := strings.NewReader("{\n \"vehicle_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\",\n \"distance\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"purpose\": \"BUSINESS\",\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"google_start_place_id\": \"<string>\",\n \"google_end_place_id\": \"<string>\",\n \"start_latitude\": \"<string>\",\n \"start_longitude\": \"<string>\",\n \"end_latitude\": \"<string>\",\n \"end_longitude\": \"<string>\",\n \"description\": \"<string>\"\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://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"vehicle_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\",\n \"distance\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"purpose\": \"BUSINESS\",\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"google_start_place_id\": \"<string>\",\n \"google_end_place_id\": \"<string>\",\n \"start_latitude\": \"<string>\",\n \"start_longitude\": \"<string>\",\n \"end_latitude\": \"<string>\",\n \"end_longitude\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/{tripId}")
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 \"vehicle_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\",\n \"distance\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"purpose\": \"BUSINESS\",\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"google_start_place_id\": \"<string>\",\n \"google_end_place_id\": \"<string>\",\n \"start_latitude\": \"<string>\",\n \"start_longitude\": \"<string>\",\n \"end_latitude\": \"<string>\",\n \"end_longitude\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vehicle": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"make_and_model": "<string>",
"year": 123,
"is_primary": true,
"is_eligible_for_deletion": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"type": "com.layerfi.routers.ApiVehicle",
"external_id": "<string>",
"license_plate": "<string>",
"vin": "<string>",
"description": "<string>",
"archived_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
},
"distance": "<string>",
"distance_source": "COMPUTED",
"trip_date": "2023-12-25",
"purpose": "BUSINESS",
"mileage_deduction_rate": "<string>",
"estimated_deduction": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"type": "com.layerfi.routers.ApiTrip",
"external_id": "<string>",
"start_address": "<string>",
"end_address": "<string>",
"google_start_place_id": "<string>",
"google_end_place_id": "<string>",
"start_latitude": "<string>",
"start_longitude": "<string>",
"end_latitude": "<string>",
"end_longitude": "<string>",
"description": "<string>",
"deleted_at": "2023-11-07T05:31:56Z"
}
}{
"type": "InvalidParameters",
"description": "<string>",
"error_enum": "InvalidPayload",
"meta": {}
}{
"type": "InvalidParameters",
"description": "<string>",
"error_enum": "InvalidPayload",
"meta": {}
}google_start_place_id or google_end_place_id change and no distance is provided, the driving distance is recomputed automatically and distance_source becomes COMPUTED. Providing an explicit distance always takes precedence and sets distance_source to MANUAL. Changing the place IDs to an incomplete pair without providing a distance returns a 400.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Content-Type must be set to application/json.
Path Parameters
The UUID of the business.
The UUID of the trip.
Body
All fields are optional. Only provided fields will be updated. If google_start_place_id or google_end_place_id change and no distance is provided, the driving distance is recomputed automatically; changing them to an incomplete pair without a distance returns a 400.
The UUID of the vehicle used for this trip.
An optional external identifier for the trip.
The distance traveled in miles, as a decimal string. Providing a distance always takes precedence and marks the trip distance as MANUAL.
The date of the trip (YYYY-MM-DD).
The purpose classification of the trip.
UNREVIEWED, BUSINESS, PERSONAL "BUSINESS"
The starting address of the trip.
The ending address of the trip.
Google Maps place ID of the trip start address, from the address suggestion endpoints.
Google Maps place ID of the trip end address, from the address suggestion endpoints.
Latitude of the start address, as a decimal string.
Longitude of the start address, as a decimal string.
Latitude of the end address, as a decimal string.
Longitude of the end address, as a decimal string.
An optional description or notes about the trip.
Response
The updated trip.
Show child attributes
Show child attributes