Filtering
The limit to the total number of IDs you can include in the filter params below is 2000. If the limit is exceeded, Samsara will respond with a
414 Request-URI Too Large
error.
By Tags
On most endpoints, you can optionally filter by tags.
Tags can have hierarchies. In other words, a parent tag can contain multiple child tags for hierarchical organization of your data. Parent tags can both contain child tags as well as directly contain data.
The tagIds
parameter will filter your request to the data contained directly within the tags listed. Data from child tags will not be listed. For example:
curl --request GET 'https://api.samsara.com/fleet/vehicles?tagIds=1478411,1047212' \
--header 'Authorization: Bearer <<token>>'
will list vehicles in either of the supplied tags (1478411
, 1047212
). Data from any child tags will not be listed.
The parentTagIds
parameter will filter your request to the data contained directly within the tags listed and from child tags. For example:
curl --request GET 'https://api.samsara.com/fleet/vehicles?parentTagIds=1054220,1901013' \
--header 'Authorization: Bearer <<token>>'
will list vehicles in either of the supplied tags (1054220
, 1901013
) as well as vehicles in any child tags.
By Object ID
On some endpoints, you can optionally filter by providing a comma-separated list of object IDs to the given query parameter. This will return data for any of the objects listed in the parameter. For example:
curl --request GET 'https://api.samsara.com/fleet/vehicles/stats?vehicleIds=212014918234495,212014918481595' \
--header 'Authorization: Bearer <<token>>'
will list data for either of the vehicle IDs provided.
Combining a tag filter and a list of object IDs will return data from the tags listed as well as the request objects.
By Timestamp
Some endpoints support filtering based on when the objects were created or updated.
- The
createdAfterTime
query parameter allows you to filter to objects that were created after a given time. - The
updateAfterTime
query parameter allows you to filter to objects that were created after a given time.
Timestamps should be provided in RFC 3339 format. See the Timestamps guide for details.
curl --request GET 'https://api.samsara.com/addresses?createdAfterTime=2020-05-26T00:00:00Z' \
--header 'Authorization: Bearer <<token>>'
Updated almost 4 years ago