This recipe calls theDocumentation Index
Fetch the complete documentation index at: https://samsara-showcase.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
/gateways endpoint, filters for Vehicle Gateway models, paginates through the response, and writes each gateway’s installation status to data.csv.
How it works
Use the requests and csv modules
The script uses
requests to make HTTP requests to the Samsara REST API and csv to write response data in CSV format.Use the /gateways endpoint
The
/gateways endpoint lists all devices associated with the dashboard, including device health and status information.Configure the Authorization header
Provide your API token in the
Authorization HTTP header using the Bearer token scheme. See Authentication for more details.Select Vehicle Gateway models
Samsara tracks the “Not Installed” status for Vehicle Gateway models. The
models parameter limits the response to those gateway models.Create the CSV file
The script opens
data.csv and writes the assetId, assetSerial, and installed column headers.Paginate through gateways
The response includes
pagination.endCursor and pagination.hasNextPage. Continue passing the latest endCursor as after until hasNextPage is false.