Trips
Update a trip
Scopes: trip:update
PATCH
/
v0
/
business
/
{business_id}
/
trips
/
{trip_id}
Update a trip
curl --request PATCH \
--url https://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"vehicle_id": "<string>",
"external_id": "<string>",
"trip_date": "2023-12-25",
"distance": 1,
"start_address": "<string>",
"end_address": "<string>",
"notes": "<string>"
}
'import requests
url = "https://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_id}"
payload = {
"vehicle_id": "<string>",
"external_id": "<string>",
"trip_date": "2023-12-25",
"distance": 1,
"start_address": "<string>",
"end_address": "<string>",
"notes": "<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: '<string>',
external_id: '<string>',
trip_date: '2023-12-25',
distance: 1,
start_address: '<string>',
end_address: '<string>',
notes: '<string>'
})
};
fetch('https://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_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://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_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([
'vehicle_id' => '<string>',
'external_id' => '<string>',
'trip_date' => '2023-12-25',
'distance' => 1,
'start_address' => '<string>',
'end_address' => '<string>',
'notes' => '<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://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_id}"
payload := strings.NewReader("{\n \"vehicle_id\": \"<string>\",\n \"external_id\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"distance\": 1,\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"notes\": \"<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://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"vehicle_id\": \"<string>\",\n \"external_id\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"distance\": 1,\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_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 \"vehicle_id\": \"<string>\",\n \"external_id\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"distance\": 1,\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"business_id": "<string>",
"vehicle_id": "<string>",
"trip_date": "2023-12-25",
"distance": 123,
"start_address": "123 Main St, San Francisco, CA",
"end_address": "456 Market St, San Francisco, CA",
"id": "<string>",
"external_id": "1234567890",
"notes": "Client lunch meeting",
"purpose": "personal",
"amount": 7.25,
"amount_reason": "Standard rate applied"
}
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Body
application/json
The id of the Vehicle used for the trip
The external ID of the Trip
Maximum string length:
255The date the trip occurred
The distance travelled, in units defined by distance_unit
Required range:
x > 0The unit of measurement for distance
Available options:
miles, kilometers Whether the trip was for business or personal use
Available options:
business, personal Where the trip started (unstructured)
Maximum string length:
500Where the trip ended (unstructured)
Maximum string length:
500Free-form notes about the trip from the user
Maximum string length:
1000Response
Successful Response
Show child attributes
Show child attributes
⌘I
Update a trip
curl --request PATCH \
--url https://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"vehicle_id": "<string>",
"external_id": "<string>",
"trip_date": "2023-12-25",
"distance": 1,
"start_address": "<string>",
"end_address": "<string>",
"notes": "<string>"
}
'import requests
url = "https://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_id}"
payload = {
"vehicle_id": "<string>",
"external_id": "<string>",
"trip_date": "2023-12-25",
"distance": 1,
"start_address": "<string>",
"end_address": "<string>",
"notes": "<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: '<string>',
external_id: '<string>',
trip_date: '2023-12-25',
distance: 1,
start_address: '<string>',
end_address: '<string>',
notes: '<string>'
})
};
fetch('https://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_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://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_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([
'vehicle_id' => '<string>',
'external_id' => '<string>',
'trip_date' => '2023-12-25',
'distance' => 1,
'start_address' => '<string>',
'end_address' => '<string>',
'notes' => '<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://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_id}"
payload := strings.NewReader("{\n \"vehicle_id\": \"<string>\",\n \"external_id\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"distance\": 1,\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"notes\": \"<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://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"vehicle_id\": \"<string>\",\n \"external_id\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"distance\": 1,\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.getasset.com/v0/business/{business_id}/trips/{trip_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 \"vehicle_id\": \"<string>\",\n \"external_id\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"distance\": 1,\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"business_id": "<string>",
"vehicle_id": "<string>",
"trip_date": "2023-12-25",
"distance": 123,
"start_address": "123 Main St, San Francisco, CA",
"end_address": "456 Market St, San Francisco, CA",
"id": "<string>",
"external_id": "1234567890",
"notes": "Client lunch meeting",
"purpose": "personal",
"amount": 7.25,
"amount_reason": "Standard rate applied"
}
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}