Open API

The Fleet Tracker Open API enables you to retrieve Fleet Tracker data programmatically using a REST interface. The API provides predefined calls for retrieving specific information. You can format the returned data to either JSON or XML. Using the API provides flexibility and allows you to integrate the data collected by the Fleet Tracker with your existing systems.

Appendix E: Open API users

To make calls to the API, make sure that you have a valid API user account. A super administrator can create API user accounts from the Fleet Tracker web portal. When API users are created, the super administrator must specify the credentials and group access of the users. For more information on adding API users, see Configuring user access.

Appendix F: Open API calls

Calls to the Open API are made in HTML in the following format:

http://<server>/com.lexmark.lfm.api/<format>/<method>?<parameter1 name>=<parameter1 value>&<parameter2 name>=<parameter2 value>

Where:

The Open API expects seven calls from the client. When the client initiates any of the seven calls, it returns with Fleet Tracker data in the specified format. All calls require authentication except for the licensed and version calls. The Open API follows the group access that is configured per API user. If a user does not have group access, then the group and its device information are not returned for any of the user’s API calls.

Exceptions

Call

URL

Method

Description

licensed

/com.lexmark.lfm.api/<format>/licensed

POST

If the Fleet Tracker is using a valid license, then this call returns a true value. Otherwise, the call returns a false value.

version

/com.lexmark.lfm.api/<format>/version

POST

This call returns the current version of the Fleet Tracker that is installed on the server.


Appendix G: Understanding methods

Method

Return value

Parameters

Example HTML

Notes

client

This call returns a list of client details, one per client.

Each record includes the following:

  • ClientId

  • ClientName

None

http://<server>/com.lexmark.lfm.api/<format>/client

If there are no clients, then no Client Details is returned.

getprintersforclient

This call returns a list of printer details.

Each printer record includes the following:

  • AssetTag

  • Firmware

  • IsManaged

  • IPAddress

  • Location

  • MACAddress

  • ModelName

  • Port

  • PrinterId

  • PrinterName

  • SerialNumber

  • clientid, clientname, or both (required)

  • start (optional)

  • limit (optional)

  • http://localhost/com.lexmark.lfm.api/xml/getprintersforclient?clientname=lexmark&start=2&limit=5

  • http://localhost/com.lexmark.lfm.api/xml/getprintersforclient?clientid=eSF&start=2&limit=5

  • http://localhost/com.lexmark.lfm.api/xml/getprintersforclient?clientname=lexmark&clientid=eSF&start=2&limit=5

If clientid or clientname is invalid, or there are no devices for the specified client, then no Printer Details is returned.

getprintercounthistoryforclient

This call returns a list of printer count record details. If the start and end times are specified, then there is one record per device that exists during the specified time range. The details are for the most recent rollup within the period. If a period is not specified, then the current device information is returned with one record per device.

Each printer count record includes the following:

  • ColorOversizeCount

  • ColorCount

  • LifeCount

  • LifeOversizeCount

  • MonoCount

  • MonoOversizeCount

  • PrinterId

  • ScanTime

  • clientid, clientname, or both (required)

  • endtime (optional)

  • limit (optional)

  • start (optional)

  • starttime (optional)

http://localhost/com.lexmark.lfm.api/<format>/getprintercounthistoryforclient?clientid=eSF&starttime=01-01-18%2000:00:00&endtime=01-01-20%2000:00:00

If clientid or clientname is invalid, or there are no devices for the specified client, then no PrinterCountRecordDetails is returned.

getprinterstatushistoryforclient

This call returns a list of printer status details. If the start and end times are specified, then there is one record per device for each rollup that occurred during the specified period. If a period is not specified, then the current device information is returned with one record per device.

Each printer status record includes the following:

  • DetectedErrorState

  • DeviceStatus

  • Location

  • PrinterId

  • PrinterStatus

  • ScanTime

  • StatusDescription

  • SystemStatus

  • clientid, clientname, or both (required)

  • endtime (optional)

  • limit (optional)

  • start (optional)

  • starttime (optional)

http://localhost/com.lexmark.lfm.api/<format>/getprinterstatushistoryforclient?clientname=lexmark&starttime=01-01-18%2000:00:00&endtime=01-01-20%2000:00:00

If clientid or clientname is invalid, or there are no devices for the specified client, then no PrinterStatusDetails is returned.

getprintersupplyhistoryforclient

This call returns a list of printer supply details. If the start and end times are specified, then there is one record per supply for each rollup that occurred during the specified period. If a period is not specified, then there is one record per supply.

Each printer supply record includes:

  • Capacity

  • Color

  • LevelRemaining

  • LifetimeCoverage

  • PercentageRemaining

  • PrinterId

  • SerialNumber

  • ScanTime

  • SupplyType

  • SupplyTypeDescription

  • SupplyName

  • SupplyUnit

  • clientid, clientname, or both (required)

  • endtime (optional)

  • limit (optional)

  • start (optional)

  • starttime (optional)

http://localhost/com.lexmark.lfm.api/<format>/getprintersupplyhistoryforclient?clientname=lexmark&clientid=eSF&starttime=01-01-18%2000:00:00&endtime=01-01-20%2000:00:00

If clientid or clientname is invalid, or there are no devices for the specified client, then no PrinterSupplyDetails is returned.


Appendix H: Open API call sample code

The following sample Java code shows how to connect programmatically and authenticate to the Fleet Tracker Open API. The code depends on the Apache HTTP Client. Download the client from the Apache Server, and then add it to the JAR location at the appropriate class path.

The following JAR files are required to build the sample code:

This code is specific to a Fleet Tracker server using HTTP and does not work with SSL.

Note: There are comments in the code to help clarify what is happening.
A screenshot of a sample API code
A screenshot of a sample API code