Blue background with blue lines on the left

Better practices for the MyGeotab API

Last updated on December 22, 2023 in Productivity by Geotab |  2 minute read

The MyGeotab SDK is a powerful way to integrate other systems with MyGeotab data.

The MyGeotab SDK is a powerful way to integrate other systems with MyGeotab data. Thousands of customers rely on the SDK daily to get everything from trips to exceptions to fuel card data (and more!) into their internal systems.


The APIs used by thousands of customers are the same ones used for MyGeotab in your browser, so it has to be powerful and flexible. But this power and flexibility also allows for abuse, which may impact performance on your system. But never fear, these are some of the common pitfalls and how to avoid them when creating an integration.


See also: Introducing the MyGeotab API Adapter

Hang on to your session

Before a developer makes any call to our API to send or receive data, they first have to authenticate, so we know which server and database to direct the call to.


When a user authenticates (either through the API or signing in to MyGeotab), the server create a “session ID” and returns it. In MyGeotab, this tells your browser to stay signed on. Using the SDK, the server returns a “session token” object, which developers can use to make subsequent calls for the life of the session, which is currently 2 weeks. MyGeotab handles this by popping up a login box. Logging in again re-authenticates against MyGeotab, and renews the session ID stored in the browser.


Authenticating before every API call is not in best practices. This will slow down any third party code because the server it’s calling against now needs to do an additional step. This could mean a time-consuming traversal over all of our servers before the requested data is returned.


The session ID already proves to the server that the caller had authenticated in the past, so it’s quick and easy to use that session token in calls.


For more information, look at the Concepts document, under the heading “Authentication”. Also mentioned in the Concepts document is how to handle session expiry under the heading “Dealing with a database move or credential expiry”.

Some things (almost) never change

A lot of data in MyGeotab changes every minute. Whether it’s the software processing exception rules created by users, or new trips made by vehicles, often there’s new data every few seconds.


Of course, anyone using the SDK has access to this data as soon as it’s created. Dynamic data in MyGeotab includes trips, exceptions, status data, fault data, and more. These datasets are updated every minute or more.


Through our DataFeed interface, it’s been made easy to watch for changes in several frequently changing and growing data items:

  • GPS logs,
  • Trips,
  • Status data,
  • Fault data and,
  • Exception events

A couple if these data items reference other entities that rarely change, however, and should not be queried via the API each time new data is received. These include:

  • Engine.UnitOfMeasure
  • Engine.Source
  • Engine.FailureMode
  • Engine.Diagnostic
  • Engine.Controller

Best practices for these items is to load them all into a caching dictionary (keyed on Id) when your SDK application first starts up, and look up the values in there as necessary, refreshing if you’d like once per day. This will almost certainly make your application run faster, as it won’t be delayed by additional server calls.


For more information on the DataFeed, see the API reference for GetFeed, and read more about handling DataFeed results.

Keep building

Geotab has seen some great third-party SDK integration work being done in the past year, and is continually committed to improving and making it easier to work with. After all, MyGeotab uses the same set of APIs available to third parties, so Geotab developers are also Geotab API users.


For more information about our SDK, please see our SDK documentation as well as our SDK forums.

If you liked this post, let us know!


Geotab's blog posts are intended to provide information and encourage discussion on topics of interest to the telematics community at large. Geotab is not providing technical, professional or legal advice through these blog posts. While every effort has been made to ensure the information in this blog post is timely and accurate, errors and omissions may occur, and the information presented here may become out-of-date with the passage of time.

Get industry tips and insights

Sign up for monthly news and tips from our award-winning fleet management blog. You can unsubscribe at any time.

Republish this article for free

Other posts you might like

Construction worker looking over at something

Routes to riches – Geotab Routing and Optimization drives operational efficiency and cost management

Geotab's Routing and Optimization software blends economic intelligence with operational strategy, reshaping fleet management for improved cost and resource efficiency.

February 15, 2024

No idling sign on

A complete guide to fleet idling: Understand, detect and stop true idling

Idling increases fuel consumption, CO2 emissions, and maintenance costs. Learn how to control it to lower your fuel spend and make your fleet more sustainable.

December 15, 2023

A fuel nozzle filling a truck

Strategies to increase fuel efficiency and manage fuel costs

Discover how to reduce fuel costs when gas prices are high.

November 2, 2023

man using tablet in parked vehicle

Streamlining fleet operations with enhanced routing and optimization updates in MyGeotab

Optimizing fleet routes is essential for staying ahead of the competition. MyGeotab's latest update includes new features that make it easier and faster for fleet operators to improve their operations, including a new Economic Model to create the most cost-effective routes.

September 19, 2023