Skip to content

Latest commit

 

History

History
658 lines (433 loc) · 17.3 KB

FleetApi.md

File metadata and controls

658 lines (433 loc) · 17.3 KB

SamsaraApi.FleetApi

All URIs are relative to https://api.samsara.com/v1

Method HTTP request Description
addFleetAddress POST /fleet/add_address /fleet/add_address
createFleetDispatchJobs POST /fleet/dispatch_jobs/create /fleet/dispatch_jobs/create
getFleet POST /fleet/list /fleet/list
getFleetDispatchJobs POST /fleet/dispatch_jobs /fleet/dispatch_jobs
getFleetDrivers POST /fleet/drivers /fleet/drivers
getFleetDriversSummary POST /fleet/drivers/summary /fleet/drivers/summary
getFleetHosAuthenticationLogs POST /fleet/hos_authentication_logs /fleet/hos_authentication_logs
getFleetHosLogs POST /fleet/hos_logs /fleet/hos_logs
getFleetLocations POST /fleet/locations /fleet/locations
getFleetMaintenanceList POST /fleet/maintenance/list /fleet/maintenance/list
getFleetTrips POST /fleet/trips /fleet/trips
updateFleetDispatchJobs POST /fleet/dispatch_jobs/update /fleet/dispatch_jobs/update
updateVehicles POST /fleet/set_data /fleet/set_data

addFleetAddress

addFleetAddress(accessToken, addressParam)

/fleet/add_address

This method adds an address book entry to the specified group.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var addressParam = new SamsaraApi.AddressParam(); // AddressParam | 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.addFleetAddress(accessToken, addressParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
addressParam AddressParam

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createFleetDispatchJobs

DispatchJobsResponse createFleetDispatchJobs(accessToken, createDispatchJobsParam)

/fleet/dispatch_jobs/create

Create dispatch jobs in the specified group.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var createDispatchJobsParam = new SamsaraApi.CreateDispatchJobsParam(); // CreateDispatchJobsParam | 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.createFleetDispatchJobs(accessToken, createDispatchJobsParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
createDispatchJobsParam CreateDispatchJobsParam

Return type

DispatchJobsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getFleet

InlineResponse2001 getFleet(accessToken, groupParam)

/fleet/list

Get list of the vehicles. This method returns a list of the vehicles in the Samsara Cloud and information about them.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var groupParam = new SamsaraApi.GroupParam(); // GroupParam | Group ID to query.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getFleet(accessToken, groupParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
groupParam GroupParam Group ID to query.

Return type

InlineResponse2001

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getFleetDispatchJobs

DispatchJobsResponse getFleetDispatchJobs(accessToken, getDispatchJobsParam)

/fleet/dispatch_jobs

Get the dispatch jobs for the specified group.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var getDispatchJobsParam = new SamsaraApi.GetDispatchJobsParam(); // GetDispatchJobsParam | 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getFleetDispatchJobs(accessToken, getDispatchJobsParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
getDispatchJobsParam GetDispatchJobsParam

Return type

DispatchJobsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getFleetDrivers

DriversRespose getFleetDrivers(accessToken, groupDriversParam)

/fleet/drivers

Get all the drivers for the specified group.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var groupDriversParam = new SamsaraApi.GroupDriversParam(); // GroupDriversParam | 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getFleetDrivers(accessToken, groupDriversParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
groupDriversParam GroupDriversParam

Return type

DriversRespose

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getFleetDriversSummary

DriversSummaryResponse getFleetDriversSummary(accessToken, driversSummaryParam)

/fleet/drivers/summary

Get the distance and time each driver in an organization has driven in a given time period.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var driversSummaryParam = new SamsaraApi.DriversSummaryParam(); // DriversSummaryParam | Org ID and time range to query.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getFleetDriversSummary(accessToken, driversSummaryParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
driversSummaryParam DriversSummaryParam Org ID and time range to query.

Return type

DriversSummaryResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getFleetHosAuthenticationLogs

HosAuthenticationLogsResponse getFleetHosAuthenticationLogs(accessToken, hosAuthenticationLogsParam)

/fleet/hos_authentication_logs

Get the HOS (hours of service) signin and signout logs for the specified driver. Only signout logs include location information.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var hosAuthenticationLogsParam = new SamsaraApi.HosAuthenticationLogsParam(); // HosAuthenticationLogsParam | 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getFleetHosAuthenticationLogs(accessToken, hosAuthenticationLogsParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
hosAuthenticationLogsParam HosAuthenticationLogsParam

Return type

HosAuthenticationLogsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getFleetHosLogs

HosLogsResponse getFleetHosLogs(accessToken, hosLogsParam)

/fleet/hos_logs

Get the HOS (hours of service) logs for the specified driver.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var hosLogsParam = new SamsaraApi.HosLogsParam(); // HosLogsParam | 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getFleetHosLogs(accessToken, hosLogsParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
hosLogsParam HosLogsParam

Return type

HosLogsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getFleetLocations

InlineResponse2002 getFleetLocations(accessToken, groupParam)

/fleet/locations

Get current location of vehicles in a group. This method returns the current location in latitude and longitude of all vehicles in a requested group.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var groupParam = new SamsaraApi.GroupParam(); // GroupParam | Group ID to query.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getFleetLocations(accessToken, groupParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
groupParam GroupParam Group ID to query.

Return type

InlineResponse2002

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getFleetMaintenanceList

InlineResponse2003 getFleetMaintenanceList(accessToken, groupParam)

/fleet/maintenance/list

Get list of the vehicles with any engine faults or check light data.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var groupParam = new SamsaraApi.GroupParam(); // GroupParam | Group ID to query.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getFleetMaintenanceList(accessToken, groupParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
groupParam GroupParam Group ID to query.

Return type

InlineResponse2003

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getFleetTrips

TripResponse getFleetTrips(accessToken, tripsParam)

/fleet/trips

Get historical trips data for specified vehicle. This method returns a set of historical trips data for the specified vehicle in the specified time range.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var tripsParam = new SamsaraApi.TripsParam(); // TripsParam | Group ID, vehicle ID and time range to query.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getFleetTrips(accessToken, tripsParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
tripsParam TripsParam Group ID, vehicle ID and time range to query.

Return type

TripResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateFleetDispatchJobs

DispatchJobsResponse updateFleetDispatchJobs(accessToken, updateDispatchJobsParam)

/fleet/dispatch_jobs/update

Update dispatch jobs in the specified group.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var updateDispatchJobsParam = new SamsaraApi.UpdateDispatchJobsParam(); // UpdateDispatchJobsParam | 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.updateFleetDispatchJobs(accessToken, updateDispatchJobsParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
updateDispatchJobsParam UpdateDispatchJobsParam

Return type

DispatchJobsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateVehicles

updateVehicles(accessToken, vehicleUpdateParam)

/fleet/set_data

This method enables the mutation of metadata for vehicles in the Samsara Cloud.

Example

var SamsaraApi = require('samsara_api');

var apiInstance = new SamsaraApi.FleetApi();

var accessToken = "accessToken_example"; // String | Samsara API access token.

var vehicleUpdateParam = new SamsaraApi.VehicleUpdateParam(); // VehicleUpdateParam | 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.updateVehicles(accessToken, vehicleUpdateParam, callback);

Parameters

Name Type Description Notes
accessToken String Samsara API access token.
vehicleUpdateParam VehicleUpdateParam

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json