webfleetconnect v1.3.0
WebfleetConnect
Library to consume WEBFLEET.connect API.
The WEBFLEET.connect API connects software applications with the Webfleet fleet management solution. Via WEBFLEET.connect you can enhance the value of all types of business solutions, including routing and scheduling optimization, ERP, Transport Management System (TMS), supply chain planning, asset management, and much more.
Check also the version for:
Installation
npm install webfleetconnect
Usage
const WebfleetConnect = require('webfleetconnect')
const webfleetConnect = WebfleetConnect.create()
webfleetConnect.showObjectReportExtern()
.then(response => console.log(response))
.catch(error => console.error(error))
WebfleetConnect.create()
returns a new Session
object which has the capabilities to request info from the WEBFLEET.connect API.
The Webfleet credential are taken from the env variables WEBFLEET_CONNECT_ACCOUNT
, WEBFLEET_CONNECT_USERNAME
, WEBFLEET_CONNECT_PASSWORD
and WEBFLEET_CONNECT_APIKEY
(if you want to know more about env variables check this link).
If your system needs to work with multiple accounts or you need to specify the credentials dynamically for some other reason, you can do it this way:
const credentials = { account: 'companyName', username: 'dev', password: 'VLm5PpiZST6U', apikey: 'ZSksD88s-F7Uf' }
const webfleetConnect = WebfleetConnect.create(credentials)
When one of the methods is used, for example showVehicleReportExtern
, it returns an object with the next properties:
webfleetConnect.showObjectReportExtern()
.then(response => console.log(response))
.catch(error => console.error(error))
response.data // gets the data as an Array of objects
response.statusCode // gets the status code of the request
response.url // gets the url to fetch the information from WEBFLEET.connect
response.toString() // returns the data as a string
// On get an error
error.error // gets the error returned by WEBFLEET.connect
error.statusCode // gets the status code of the request
error.url // gets the url to fetch the information from WEBFLEET.connect
The methods available in this library are the same that are documented in the WEBFLEET.connect docs page.
Params
In order to add params to a request is as easy as passing an object of options in the request like:
const options = { filterstring: 'ECO', objectgroupname: 'Vehiculos', ungroupedonly: true }
const response = await webfleetConnect.showObjectReportExtern(options)
Extra config
The Session
object works with the default configuration:
{ lang: 'en', outputformat: 'csv', useISO8601: false, useUTF8: false }
but you can change the default configuration when you create the object:
const params = {
account: 'companyName',
username: 'dev',
password: 'VLm5PpiZST6U',
apikey: 'ZSksD88s-F7Uf',
lang: 'de',
outputformat: 'json'
}
const webfleetConnect = WebfleetConnect.create(params)
Get the URL only
You can get the full URL to request without actually connection to Webfleet Connect API by using the function getURL
const options = { filterstring: 'ECO', objectgroupname: 'Vehiculos', ungroupedonly: true }
const url = await webfleetConnect.getUrl('showObjectReportExtern', options)
console.log(url)
Methods list
Mesage queues:
Objects:
- showObjectReportExtern
- showVehicleReportExtern
- showNearestVehicles
- showContracts
- updateVehicle
- showObjectGroups
- showObjectGroupObjects
- attachObjectToGroup
- detachObjectFromGroup
- insertObjectGroup
- deleteObjectGroup
- updateObjectGroup
- switchOutput
- showWakeupTimers
- updateWakeupTimers
- getObjectFeatures
- updateContractInfo
- getObjectCanSignals
- getObjectCanMalfunctions
- getElectricVehicleData
- getActiveAssetCouplings
Orders:
- sendOrderExtern
- sendDestinationOrderExtern
- updateOrderExtern
- updateDestinationOrderExtern
- insertDestinationOrderExtern
- cancelOrderExtern
- assignOrderExtern
- reassignOrderExtern
- deleteOrderExtern
- clearOrdersExtern
- showOrderReportExtern
- showOrderWaypoints
Messages:
- sendTextMessageExtern
- clearTextMessagesExtern
- showMessages
- sendBinaryMessage
- resetBinaryMessages
- clearBinaryMessages
Drivers:
- showDriverReportExtern
- insertDriverExtern
- updateDriverExtern
- deleteDriverExtern
- showOptiDriveIndicator
- showDriverGroups
- showDriverGroupDrivers
- attachDriverToGroup
- detachDriverFromGroup
- insertDriverGroup
- deleteDriverGroup
- updateDriverGroup
- attachDriverToVehicle
- detachDriverFromVehicle
- getDriverRdtRules
- updateDriverRdtRules
Addresses:
- showAddressReportExtern
- showAddressGroupReportExtern
- showAddressGroupAddressReportExtern
- insertAddressExtern
- updateAddressExtern
- deleteAddressExtern
- attachAddressToGroupExtern
- detachAddressFromGroupExtern
- insertAddressGroupExtern
- deleteAddressGroupExtern
Events:
- showEventReportExtern
- acknowledgeEventExtern
- resolveEventExtern
- getEventForwardConfigs
- getEventForwardConfigRecipients
- insertEventForwardConfig
- updateEventForwardConfig
- deleteEventForwardConfig
Trips and working times:
- showTripReportExtern
- showTripSummaryReportExtern
- showTracks
- updateLogbook
- showLogbook
- showLogbook_history
- updateLogbookMode
- updateLogbookDriver
- showWorkingTimes
- showStandStills
- showIdleExceptions
- getObjectKpis
- getDriverKpis
- getRemainingDrivingTimesEu
Miscellaneous reports:
- getChargerConnections
- showIoReportExtern
- showAccelerationEvents
- showSpeedingEvents
- showDigitalInputStateMileage
- getChargerConnections
Geocoding and routing:
Configuration and security:
- showSettings
- createSession
- terminateSession
- showAccountOrderStates
- updateAccountOrderState
- showAccountOrderAutomations
- updateAccountOrderAutomation
- getAccountStatusMessages
- getStatusMessages
- setVehicleConfig
- getVehicleConfig
- setStatusMessages
- setAccountStatusMessages
User management:
Vehicle maintenance:
- insertMaintenanceSchedule
- updateMaintenanceSchedule
- deleteMaintenanceSchedule
- showMaintenanceSchedules
- showMaintenanceTasks
- resolveMaintenanceTask
Reporting:
- getArchivedReportList
- getArchivedReport
- deleteArchivedReport
- getReportList
- createReport
- sendReportViaMail
Areas:
- getAreas
- insertArea
- deleteArea
- updateArea
- getAreaPoints
- getAreaAssignments
- insertAreaAssignment
- deleteAreaAssignment
- getAreaSchedules
- insertAreaSchedule
- deleteAreaSchedule
LINK.connect:
- sendAuxDeviceData
- getLocalAuxDeviceConfig
- configureLocalAuxDevice
- getRemoteAuxDeviceConfig
- configureRemoteAuxDevice
- removeRemoteAuxDeviceConfig
- clearAuxDeviceDataQueue
- resetAuxDeviceData
Plugins: