Client libraries and SDKs
Libraries and tools for interacting with your Samsara integration.
SDKs
Samsara's SDKs reduce the amount of work required to integrate the REST APIs. Find installation instructions and examples of API requests in the readme for each SDK.
For issues with the usability of the SDK, please create an issue in the respective GitHub repository. For any other API and developer questions, please direct those to the support team by opening a ticket
Samsara Python
Installation
pip install samsara-apiUsage
from samsara import Samsara
# Initialize the client with your API token
client = Samsara(
token="YOUR_TOKEN",
)
# Get your organization information
org_info = client.organization_info.get_organization_info()
print(f"Organization: {org_info.data.name}")
# List all vehicles in your fleet
vehicles = client.vehicles.list()
for vehicle in vehicles:
print(f"Vehicle: {vehicle.name} (ID: {vehicle.id})")
# Get specific vehicle details
vehicle = client.vehicles.get(id="YOUR_VEHICLE_ID")
print(f"Vehicle VIN: {vehicle.data.vin}")Samsara.Net
Installation
dotnet add package Samsara.NetUsage
using Samsara.Net.Addresses;
using Samsara.Net;
var client = new SamsaraClient();
await client.Addresses.CreateAsync(
new CreateAddressRequest
{
FormattedAddress = "350 Rhode Island St, San Francisco, CA",
Geofence = new CreateAddressRequestGeofence(),
Name = "Samsara HQ",
}
);Samsara TypeScript
Installation
npm install @samsarahq/samsaraUsage
import { SamsaraClient } from "@samsarahq/samsara";
const client = new SamsaraClient({ token: "YOUR_TOKEN" });
const response = await client.vehicles.list();
for await (const item of response) {
console.log(item);
}
// Or you can manually iterate page-by-page
const page = await client.vehicles.list();
while (page.hasNextPage()) {
page = page.getNextPage();
}Samsara Java
Installation
Add the dependency in your build.gradle file:
dependencies {
implementation 'com.samsara:samsara-java-sdk'
}Usage
package com.example.usage;
import com.samsara.api.SamsaraApiClient;
import com.samsara.api.resources.vehicles.requests.ListVehiclesRequest;
public class Example {
public static void main(String[] args) {
SamsaraApiClient client = SamsaraApiClient
.builder()
.token("<token>")
.build();
client.vehicles().list(
ListVehiclesRequest
.builder()
.build()
);
}
}Updated 17 days ago
