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-api
Usage
from samsara import Samsara
client = Samsara(
token="YOUR_TOKEN",
)
response = client.vehicles.stats.list()
for item in response:
yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
yield page
Samsara.Net
Installation
dotnet add package Samsara.Net
Usage
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/samsara
Usage
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 Ruby
Installation
gem install samsara_api
Usage
require 'samsara_api'
client = Samsara::Client.new(token: ENV["SAMSARA_API_TOKEN"])
client.vehicles.list.each do |vehicle|
p [vehicle.id]
end
Updated about 12 hours ago