Community
Time on Site Report Does not Tie to Endpoints
We use the "Time of Site Report" that is available in the Reports section. I can seem to find the API endpoints that will tie the assets and time on site to this report. I have
I thought it would be the Trip History endpoints, but the time is off. Any ideas on what endpoint to use to gather the Time of Site information?
Posted by G Maka 8 months ago
Total fuel used
Hello, is it possible to get the total fuel used so far and the fuel type of vehicle?
Posted by George Paraskevopoulos 8 months ago
Power Bi API - Idling
Hi I am trying to get my API connector to work in power query but am getting 400 errors for the following:
let parameters = (after as any,limit as any,startMs as text,endMs as text, vehicleIds as any,tagIds as any,parentTagIds as any,isPtoActive as any,minIdlingDurationMinutes as any) =>
let
accessToken = "'API Token Here'",
baseUrl = "<https://api.samsara.com">,
endpointUrl = "/fleet/reports/vehicle/idling",
initialRequest = Json.Document(Web.Contents(baseUrl,\[RelativePath = endpointUrl & "?after=" & after & "&limit=" & limit & "&startMs=" & startMs & "&endMs=" & endMs & "&vehicleIds=" & vehicleIds & "&tagIds=" & tagIds & "&parentTagIds=" & parentTagIds & "&isPtoActive=" & isPtoActive & "&minIdlingDurationMinutes=" & minIdlingDurationMinutes, Headers = [Authorization = "Bearer " & accessToken]]))
in
initialRequest
in
parameters
I have gotten some simpler APIs to work, but these parameters are throwing me for a loop. What am I doing wrong here?
<br>
Thank you!
<br>
Posted by David Anderson 6 months ago
Create Recurring Routes Using the API
Is it possible to create a recurring route using the API or via the CSV upload?
Posted by Sam Gamez 5 months ago
staticAssignedDriver - When does this get updated?
I am writing a python script which runs 7pm each day.
The script calls <https://api.samsara.com/fleet/vehicles> and returns the vehicle name and the staticAssignedDriver WHERE staticAssignedDriver is blank / null.
The purpose of this is to detect which drivers may have potentially forgot to remove their tacho card out the lorry at the end of their shift.
The data being returned sometimes is not true.
I.E a vehicle is showing a staticAssignedDriver, i'll go into the lorry and there is no card in the tacho machine.
When does staticAssignedDriver get updated?
Thanks
```
import requests
import json
url = "https://api.samsara.com/fleet/vehicles"
headers = {
"Authorization": "Bearer samsara_api_REDACTED"
}
mailgun_api_key = "REDACTED"
mailgun_url = f"https://api.eu.mailgun.net/v3/REDACTED/messages"
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json().get('data', [])
filtered_data = [
{
"name": entry['name'],
"driver_name": entry['staticAssignedDriver'].get('name', '')
}
for entry in data
if 'staticAssignedDriver' in entry and entry['staticAssignedDriver'].get('name', '') != ''
]
email_body = "\n".join([f"Vehicle: {entry['name']} | Driver: {entry['driver_name']}" for entry in filtered_data])
mailgun_params = {
"from": "[email protected]",
"to": "[email protected]",
"subject": "Potentially have cards left in",
"text": f"The following vehicles may have cards in\n\n{email_body}"
}
mailgun_response = requests.post(
mailgun_url,
auth=("api", mailgun_api_key),
data=mailgun_params
)
if mailgun_response.status_code == 200:
print("Email sent successfully.")
else:
print(f"Error sending email: {mailgun_response.status_code}, {mailgun_response.text}")
else:
print(f"Error: {response.status_code}, {response.text}")
```
Posted by Daniel Stanton 6 months ago
Not able to embed live tracking in iframe.
Hi I am developing a TMS for a company which uses Samsara. They provide a live tracking url like
<br>
<https://cloud.samsara.com/o/107724/fleet/viewer/1P38H37dAe9LSkkTzQlC>
<br>
I am unable to iframe this url on our TMS.
<br>
Is there any different url or something to show the live tracking in our system.
Posted by Rahul 5 months ago
Looking for Route and Trip relationship
How to analyze which route driver is taking for particular trip if Route Id is not present in Trip table?
<br>
Posted by Apurva Kadam 5 months ago
Looking for an APP - Efficiency
Looking for a way to use the data that is being stored in samsara a bit more on calculating the efficiency. For example. Looking at routes planned vs what was driven mileage and time duration.
<br>
Posted by test attacker 5 months ago
ETA Tracking - QA
Hi - We use Samsara to track our entire fleet. We are excited to use Samsara and admire the functionality. We have services built to capture and return ETA for our routes and stops.
Any changes to these services we have to put a driver on truck and move around the city to test if the services are working or not. Its extremely inconvenient and certainly not a cost effective solution..
Ask: Is there any way we can test the ROUTE and its ETA by simulation without putting a driver on the truck ?
Any help will be highly appreciated..
Thanks, Venky
Posted by Venky 6 months ago
Dashcam Video or Images not found
I am trying to use the API to retrieve historical video or images. I am using the following URL:
<https://api.samsara.com/fleet/vehicles/cameras/media/history>
However, I get an error message:
404 page not found
Why is this link broken? What is the correct link?
Posted by Erik Antonsson 7 months ago