@datafire/traccar
Client library for TraccarInstallation and Usage
npm install --save @datafire/traccar
let traccar = require('@datafire/traccar').create({
username: "",
password: "",
host: ""
});
.then(data => {
console.log(data);
});
Description
Open Source GPS Tracking PlatformActions
attributes.computed.get
Without params, it returns a list of Attributes the user has access totraccar.attributes.computed.get({}, context)
Input
- input
object
boolean
: Can only be used by admins or managers to fetch all entities
userId integer
: Standard users can use this only with their own userId
deviceId integer
: Standard users can use this only with deviceIds, they have access to
groupId integer
: Standard users can use this only with groupIds, they have access to
refresh boolean
Output
- output
array
attributes.computed.post
Create an Attributetraccar.attributes.computed.post({
"body": {}
}, context)
Input
- input
object
Output
- output Attribute
attributes.computed.id.delete
Delete an Attributetraccar.attributes.computed.id.delete({
"id": 0
}, context)
Input
- input
object
integer
Output
Output schema unknownattributes.computed.id.put
Update an Attributetraccar.attributes.computed.id.put({
"id": 0,
"body": {}
}, context)
Input
- input
object
integer
body required AttributeOutput
- output Attribute
calendars.get
Without params, it returns a list of Calendars the user has access totraccar.calendars.get({}, context)
Input
- input
object
boolean
: Can only be used by admins or managers to fetch all entities
userId integer
: Standard users can use this only with their own userIdOutput
- output
array
calendars.post
Create a Calendartraccar.calendars.post({
"body": {}
}, context)
Input
- input
object
Output
- output Calendar
calendars.id.delete
Delete a Calendartraccar.calendars.id.delete({
"id": 0
}, context)
Input
- input
object
integer
Output
Output schema unknowncalendars.id.put
Update a Calendartraccar.calendars.id.put({
"id": 0,
"body": {}
}, context)
Input
- input
object
integer
body required CalendarOutput
- output Calendar
commands.get
Without params, it returns a list of Saved Commands the user has access totraccar.commands.get({}, context)
Input
- input
object
boolean
: Can only be used by admins or managers to fetch all entities
userId integer
: Standard users can use this only with their own userId
deviceId integer
: Standard users can use this only with deviceIds, they have access to
groupId integer
: Standard users can use this only with groupIds, they have access to
refresh boolean
Output
- output
array
commands.post
Create a Saved Commandtraccar.commands.post({
"body": {}
}, context)
Input
- input
object
Output
- output Command
commands.send.get
Return a list of saved commands linked to Device and its groups, filtered by current Device protocol supporttraccar.commands.send.get({}, context)
Input
- input
object
integer
: Standard users can use this only with deviceIds, they have access toOutput
- output
array
commands.send.post
Dispatch a new command or Saved Command if body.id settraccar.commands.send.post({
"body": {}
}, context)
Input
- input
object
Output
- output Command
commands.types.get
Fetch a list of available Commands for the Device or all possible Commands if Device ommitedtraccar.commands.types.get({}, context)
Input
- input
object
integer
: Internal device identifier. Only works if device has already reported some locations
protocol string
: Protocol name. Can be used instead of device id
textChannel boolean
: When true
return SMS commands. If not specified or false
return data commandsOutput
- output
array
commands.id.delete
Delete a Saved Commandtraccar.commands.id.delete({
"id": 0
}, context)
Input
- input
object
integer
Output
Output schema unknowncommands.id.put
Update a Saved Commandtraccar.commands.id.put({
"id": 0,
"body": {}
}, context)
Input
- input
object
integer
body required CommandOutput
- output Command
devices.get
Without any params, returns a list of the user's devicestraccar.devices.get({}, context)
Input
- input
object
boolean
: Can only be used by admins or managers to fetch all entities
userId integer
: Standard users can use this only with their own userId
id integer
: To fetch one or more devices. Multiple params can be passed like id=31&id=42
uniqueId string
: To fetch one or more devices. Multiple params can be passed like uniqueId=333331&uniqieId=44442
Output
- output
array
devices.post
Create a Devicetraccar.devices.post({
"body": {}
}, context)
Input
- input
object
Output
- output Device
devices.id.delete
Delete a Devicetraccar.devices.id.delete({
"id": 0
}, context)
Input
- input
object
integer
Output
Output schema unknowndevices.id.put
Update a Devicetraccar.devices.id.put({
"id": 0,
"body": {}
}, context)
Input
- input
object
integer
body required DeviceOutput
- output Device
devices.id.accumulators.put
Update total distance and hours of the Devicetraccar.devices.id.accumulators.put({
"id": 0,
"body": {}
}, context)
Input
- input
object
integer
body required DeviceAccumulatorsOutput
Output schema unknowndrivers.get
Without params, it returns a list of Drivers the user has access totraccar.drivers.get({}, context)
Input
- input
object
boolean
: Can only be used by admins or managers to fetch all entities
userId integer
: Standard users can use this only with their own userId
deviceId integer
: Standard users can use this only with deviceIds, they have access to
groupId integer
: Standard users can use this only with groupIds, they have access to
refresh boolean
Output
- output
array
drivers.post
Create a Drivertraccar.drivers.post({
"body": {}
}, context)
Input
- input
object
Output
- output Driver
drivers.id.delete
Delete a Drivertraccar.drivers.id.delete({
"id": 0
}, context)
Input
- input
object
integer
Output
Output schema unknowndrivers.id.put
Update a Drivertraccar.drivers.id.put({
"id": 0,
"body": {}
}, context)
Input
- input
object
integer
body required DriverOutput
- output Driver
events.id.get
traccar.events.id.get({
"id": 0
}, context)
Input
- input
object
integer
Output
- output Event
geofences.get
Without params, it returns a list of Geofences the user has access totraccar.geofences.get({}, context)
Input
- input
object
boolean
: Can only be used by admins or managers to fetch all entities
userId integer
: Standard users can use this only with their own userId
deviceId integer
: Standard users can use this only with deviceIds, they have access to
groupId integer
: Standard users can use this only with groupIds, they have access to
refresh boolean
Output
- output
array
geofences.post
Create a Geofencetraccar.geofences.post({
"body": {}
}, context)
Input
- input
object
Output
- output Geofence
geofences.id.delete
Delete a Geofencetraccar.geofences.id.delete({
"id": 0
}, context)
Input
- input
object
integer
Output
Output schema unknowngeofences.id.put
Update a Geofencetraccar.geofences.id.put({
"id": 0,
"body": {}
}, context)
Input
- input
object
integer
body required GeofenceOutput
- output Geofence
groups.get
Without any params, returns a list of the Groups the user belongs totraccar.groups.get({}, context)
Input
- input
object
boolean
: Can only be used by admins or managers to fetch all entities
userId integer
: Standard users can use this only with their own userIdOutput
- output
array
groups.post
Create a Grouptraccar.groups.post({
"body": {}
}, context)
Input
- input
object
Output
- output Group
groups.id.delete
Delete a Grouptraccar.groups.id.delete({
"id": 0
}, context)
Input
- input
object
integer
Output
Output schema unknowngroups.id.put
Update a Grouptraccar.groups.id.put({
"id": 0,
"body": {}
}, context)
Input
- input
object
integer
body required GroupOutput
- output Group
maintenance.get
Without params, it returns a list of Maintenance the user has access totraccar.maintenance.get({}, context)
Input
- input
object
boolean
: Can only be used by admins or managers to fetch all entities
userId integer
: Standard users can use this only with their own userId
deviceId integer
: Standard users can use this only with deviceIds, they have access to
groupId integer
: Standard users can use this only with groupIds, they have access to
refresh boolean
Output
- output
array
maintenance.post
Create a Maintenancetraccar.maintenance.post({
"body": {}
}, context)
Input
- input
object
Output
- output Maintenance
maintenance.id.delete
Delete a Maintenancetraccar.maintenance.id.delete({
"id": 0
}, context)
Input
- input
object
integer
Output
Output schema unknownmaintenance.id.put
Update a Maintenancetraccar.maintenance.id.put({
"id": 0,
"body": {}
}, context)
Input
- input
object
integer
body required MaintenanceOutput
- output Maintenance
notifications.get
Without params, it returns a list of Notifications the user has access totraccar.notifications.get({}, context)
Input
- input
object
boolean
: Can only be used by admins or managers to fetch all entities
userId integer
: Standard users can use this only with their own userId
deviceId integer
: Standard users can use this only with deviceIds, they have access to
groupId integer
: Standard users can use this only with groupIds, they have access to
refresh boolean
Output
- output
array
notifications.post
Create a Notificationtraccar.notifications.post({
"body": {}
}, context)
Input
- input
object
Output
- output Notification
notifications.test.post
Send test notification to current user via Email and SMStraccar.notifications.test.post(null, context)
Input
This action has no parametersOutput
Output schema unknownnotifications.types.get
Fetch a list of available Notification typestraccar.notifications.types.get(null, context)
Input
This action has no parametersOutput
- output
array
notifications.id.delete
Delete a Notificationtraccar.notifications.id.delete({
"id": 0
}, context)
Input
- input
object
integer
Output
Output schema unknownnotifications.id.put
Update a Notificationtraccar.notifications.id.put({
"id": 0,
"body": {}
}, context)
Input
- input
object
integer
body required NotificationOutput
- output Notification
permissions.delete
Unlink an Object from another Objecttraccar.permissions.delete({
"body": {}
}, context)
Input
- input
object
Output
Output schema unknownpermissions.post
Link an Object to another Objecttraccar.permissions.post({
"body": {}
}, context)
Input
- input
object
Output
- output Permission
positions.get
We strongly recommend using Traccar WebSocket API instead of periodically polling positions endpoint. Without any params, it returns a list of last known positions for all the user's Devices. from and to fields are not required with id.traccar.positions.get({}, context)
Input
- input
object
integer
: deviceId is optional, but requires the from and to parameters when used
from string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
to string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
id integer
: To fetch one or more positions. Multiple params can be passed like id=31&id=42
Output
- output
array
reports.events.get
At least one deviceId or one groupId must be passedtraccar.reports.events.get({
"from": "",
"to": ""
}, context)
Input
- input
object
array
groupId array
type array
: % can be used to return events of all types
from required string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
to required string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
Output
- output
array
reports.route.get
At least one deviceId or one groupId must be passedtraccar.reports.route.get({
"from": "",
"to": ""
}, context)
Input
- input
object
array
groupId array
from required string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
to required string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
Output
- output
array
reports.stops.get
At least one deviceId or one groupId must be passedtraccar.reports.stops.get({
"from": "",
"to": ""
}, context)
Input
- input
object
array
groupId array
from required string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
to required string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
Output
- output
array
reports.summary.get
At least one deviceId or one groupId must be passedtraccar.reports.summary.get({
"from": "",
"to": ""
}, context)
Input
- input
object
array
groupId array
from required string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
to required string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
Output
- output
array
reports.trips.get
At least one deviceId or one groupId must be passedtraccar.reports.trips.get({
"from": "",
"to": ""
}, context)
Input
- input
object
array
groupId array
from required string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
to required string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
Output
- output
array
server.get
Fetch Server informationtraccar.server.get(null, context)
Input
This action has no parametersOutput
- output Server
server.put
Update Server informationtraccar.server.put({
"body": {}
}, context)
Input
- input
object
Output
- output Server
session.delete
Close the Sessiontraccar.session.delete(null, context)
Input
This action has no parametersOutput
Output schema unknownsession.get
Fetch Session informationtraccar.session.get({}, context)
Input
- input
object
string
Output
- output User
session.post
Create a new Sessiontraccar.session.post({
"body": null
}, context)
Input
- input
object
Output
- output User
statistics.get
Fetch server Statisticstraccar.statistics.get({
"from": "",
"to": ""
}, context)
Input
- input
object
string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
to required string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
Output
- output
array
users.get
Fetch a list of Userstraccar.users.get({}, context)
Input
- input
object
string
: Can only be used by admin or manager usersOutput
- output
array
users.post
Create a Usertraccar.users.post({
"body": {}
}, context)
Input
- input
object
Output
- output User
users.id.delete
Delete a Usertraccar.users.id.delete({
"id": 0
}, context)
Input
- input
object
integer
Output
Output schema unknownusers.id.put
Update a Usertraccar.users.id.put({
"id": 0,
"body": {}
}, context)
Input
- input
object
integer
body required UserOutput
- output User
Definitions
Attribute
- Attribute
object
string
description string
expression string
id integer
type string
: String|Number|BooleanCalendar
- Calendar
object
object
data string
: base64 encoded in iCalendar format
id integer
name string
Command
- Command
object
object
description string
deviceId integer
id integer
type string
CommandType
- CommandType
object
string
Device
- Device
object
object
category string
contact string
disabled boolean
geofenceIds array
* items `integer`
groupId integer
id integer
lastUpdate string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
model string
name string
phone string
positionId integer
status string
uniqueId string
DeviceAccumulators
- DeviceAccumulators
object
integer
hours number
totalDistance number
: in metersDriver
- Driver
object
object
id integer
name string
uniqueId string
Event
- Event
object
object
deviceId integer
geofenceId integer
id integer
maintenanceId integer
positionId integer
serverTime string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
type string
Geofence
- Geofence
object
string
attributes object
calendarId integer
description string
id integer
name string
Group
- Group
object
object
groupId integer
id integer
name string
Maintenance
- Maintenance
object
object
id integer
name string
period number
start number
type string
Notification
- Notification
object
boolean
attributes object
calendarId integer
id integer
mail boolean
sms boolean
type string
web boolean
NotificationType
- NotificationType
object
string
Permission
- Permission
object
: This is a permission map that contain two object indexes. It is used to link/unlink objects. Order is important. Example: { deviceId:8, geofenceId: 16 }
integer
: Computed Attribute Id, can be second parameter only
calendarId integer
: Calendar Id, can be second parameter only and only in combination with userId
deviceId integer
: Device Id, can be first parameter or second only in combination with userId
driverId integer
: Driver Id, can be second parameter only
geofenceId integer
: Geofence Id, can be second parameter only
groupId integer
: Group Id, can be first parameter or second only in combination with userId
managedUserId integer
: User Id, can be second parameter only and only in combination with userId
userId integer
: User Id, can be only first parameterPosition
- Position
object
number
address string
altitude number
attributes object
course number
deviceId integer
deviceTime string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
fixTime string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
id integer
latitude number
longitude number
network object
outdated boolean
protocol string
serverTime string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
speed number
: in knots
valid boolean
ReportStops
- ReportStops
object
string
deviceId integer
deviceName string
duration integer
endTime string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
engineHours integer
lat number
lon number
spentFuel number
: in liters
startTime string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
ReportSummary
- ReportSummary
object
number
: in knots
deviceId integer
deviceName string
distance number
: in meters
engineHours integer
maxSpeed number
: in knots
spentFuel number
: in litersReportTrips
- ReportTrips
object
number
: in knots
deviceId integer
deviceName string
distance number
: in meters
driverName string
driverUniqueId integer
duration integer
endAddress string
endLat number
endLon number
endTime string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
maxSpeed number
: in knots
spentFuel number
: in liters
startAddress string
startLat number
startLon number
startTime string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
Server
- Server
object
object
bingKey string
coordinateFormat string
deviceReadonly boolean
forceSettings boolean
id integer
latitude number
limitCommands boolean
longitude number
map string
mapUrl string
poiLayer string
readonly boolean
registration boolean
twelveHourFormat boolean
version string
zoom integer
Statistics
- Statistics
object
integer
activeUsers integer
captureTime string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
messagesReceived integer
messagesStored integer
requests integer
User
- User
object
boolean
attributes object
coordinateFormat string
deviceLimit integer
deviceReadonly boolean
disabled boolean
email string
expirationTime string
: in IS0 8601 format. eg. 1963-11-22T18:30:00Z
id integer
latitude number
limitCommands boolean
longitude number
map string
name string
password string
phone string
poiLayer string
readonly boolean
token string
twelveHourFormat boolean
userLimit integer
zoom integer