Welcome to the GPS Insight API Guide for Developers! This documentation is designed for people familiar with object-oriented programming concepts. You should also be familiar with GPS Insight capabilities from a user's point of view.
An application programming interface (API) specifies how some software components should interact with each other. GPS Insight's API provides a form of communication via XML or JSON coding language to push your fleet’s data from our system to your back-end systems (e.g., ERP, Dispatch, CRM). By using our API you can effortlessly integrate your fleet’s data into your back-end systems to provide transparency into payroll, fuel card transactions, additional documentation, asset management, and more.
The typical process for interacting with our API is broken into three high-level steps. You'll need to:
-
Username/Password: The Username/Password authentication is the simplest method of retrieving a session token. Use this method if you are developing for internal applications where your password can be kept secret.
- App Token: The App Token authentication is the most secure method of retrieving a session token by using an alias for your login credentials. Use this method if you want to avoid passing your login credentials via HTTP requests or sharing your portal credentials with vendors. This limited access can be revoked or changed at any time.
To obtain a session token with Username/Password |
The following response appears:
|
To obtain a session token with an App Token |
The Manage API Apps page appears.
A new App Token is generated:
The following response appears:
|
Technically, you've already made a request (authentication) that returned a session token. Now, you can make additional requests--this time to return data from your GPS Insight account.
Request Structure
Before you can make this request, you must understand the request structure.
Use the table below to understand the parts of the following request structure:
https://api.gpsinsight.com/v2/vehicle/location/xml?session_token=abcd1234&vehicle=truck1
Alert | Example | Required |
---|---|---|
API Endpoint Specifies the API endpoint or URL (followed by the http protocol |
api.gpsinsight.com/v2 | x |
Class Specifies the service or class. |
vehicle | x |
Method Specifies the method. |
location | x |
Output Format Specifies the formatting for responses. Available formats include:
|
xml | |
Session Token Specifies the session token obtained from authentication. |
session_token=abcd1234 | x |
Method Parameter(s) Specifies the optional parameter(s) within the method. Separate multiple parameters with an ampersand (&). |
vehicle=truck1 |
The default response will be structured with a head section with meta data about the request, an optional errors section, and a data section containing the formatted response data:
"head": { . . . },
"errors": [{ . . }],
"data": [{ . . . }]
}
Element | Description | Example |
---|---|---|
status | OK or ERROR if errors were encountered | OK |
method | The method used to produce the response | listvehicles |
context | The user_context under which the response was generated | customer |
request_time | The server time at the request (in MST) | May 21 2014 10:47:38 |
session_start | The server time at the start of the current session (in MST) | May 21 2014 10:44:47 |
request_count | The number of times the request has been issued from the current account | 1 |
Element | Description | Example |
---|---|---|
code | Usually a standard HTTP error code such as 400, 404, 500, etc. | 403 |
message | The standard HTTP message that accompanies the code. For security purposes we do not provide detailed error logs | Forbidden (session does not exist) |
How you process the response depends entirely on your purpose for using the API and the programming language in which the interfacing
application is written. GPS Insight provides you with the following simple JavaScript example for how you might use the GPS Insight
API to display vehicle location information--in this case on a third-party web map that resides outside of the GPS Insight portal
(e.g., your company's website).
https://api.gpsinsight.com/v2/examples/javascript_example.html
Due to how frequently the IPs will change our Cloud-Hosted environment, it is not recommended that users whitelist IPs for API purposes. Generally, it will be difficult to keep up with the changing addresses. If you want to try, here is some documentation from AWS about how to stay up to date on the IP addresses.
We recommend, if your policy requires whitelisting, that you whitelist either of our DNSs.
- gpsinsight.com (preferred)
- api.gpsinsight.com