The Samsara Web API allows access to all of your data in the Samsara Cloud via an HTTPS-based RPC-style API. Detailed information can be found in the API Guide here: developers.samsara.com
Key points:
- Realtime and historical data for any time period and sample frequency can be requested
- Temperature, Humidity, Power and Input Module data available
- Access to the API is enabled for all customers
- Authentication security is provided by an API Token and Secret Key system
- Data delivered securely in JSON format over TLS
Creating API Tokens
API Tokens for secure access to the API can be viewed and created on the API Tokens Settings page. Below are instructions on how to set up an API token:
1. On your Samsara Dashboard, navigate to Settings > API Tokens.
2. Click + Add an API Token to create a new token.
- Select a Name for your API token. We recommend creating a new API token with a descriptive name for each application you create.
- Select a Permission Scope for your API token:
3. Select Save once you've inputted a Name and Permission Scope.
You may request and delete as many API Tokens as required.
API versions are released periodically and more information on versioning can be discovered at https://developers.samsara.com/.
Please note that Read-Only Admins do not have access to view or create API Tokens on the Samsara Dashboard.
Upgrading API Tokens
You can upgrade the API token version in your admin console. Samsara only increments the API version when there is a breaking change to the API.
Examples of breaking changes include:
- Adding a mandatory request parameter to existing API methods
- Removing properties from existing API responses
For non-breaking changes, these will be accessible across all versions of the API.
Examples of non-breaking changes include:
- Adding new API resources
- Adding new optional request parameters to existing API methods
- Adding new properties to existing API responses
- Changing the order of properties in existing API responses
- Changing the length or format of object IDs or other opaque strings
How to upgrade your API version
You can find the version on the API Tokens page in the dashboard:
Upgrading your API version will affect the API calls you make without a Samsara-Version header: the parameters you can send and the structure of objects returned.
You can test a newer version for an API call by setting the Samsara-Version header. In the example code below,
Once you are confident your code can handle the latest version, click on the "Upgrade" button in your Dashboard. This switches the version used by API calls with no Samsara-Version header.
Comments
0 comments
Please sign in to leave a comment.