This package, `mg-api-node`, functions as an unofficial Node.js client for programmatically interacting with the MyGeotab API. It offers capabilities for authentication, executing API calls (such as `Get`, `call`, and `multicall`), and managing request timeouts and session IDs to optimize repeated interactions. The latest stable version is 1.3.1. Its release cadence has been infrequent, with the most recent feature addition (request timeout functionality) in v1.3.0. While it once served as a direct Node.js interface for MyGeotab, this project is now officially deprecated. Users are strongly advised to transition to the `mg-api-js` package for ongoing support, new feature development, and improved maintainability.
npm install mg-api-nodeVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic authentication and a 'Get' API call to fetch user data using callback patterns.
Migrate to the `mg-api-js` package, which is the officially supported successor. `mg-api-js` offers modern features, active maintenance, and improved API patterns.
For new projects or migrations, consider `mg-api-js` which utilizes Promises/async-await. If stuck with `mg-api-node`, use utility libraries like `util.promisify` (Node.js built-in) or `async` to manage callbacks.
Ensure `userName`, `password`, and `database` are correct. Verify user permissions within MyGeotab. The library includes reauthentication logic for `InvalidUserException` but correct initial setup is critical.
From v1.3.0 onwards, you can pass a timeout (milliseconds) and an optional timeout callback to `api.call()` and `api.multicall()` to prevent indefinite waits. For example: `api.call(..., 10000, () => console.log('Request timed out'))`.Change your import statement to `const API = require('mg-api-node');` to correctly load the CommonJS module.Double-check your `userName`, `password`, and `database` parameters. Ensure the provided user has necessary API access within the MyGeotab system.
Implement robust error handling and retry mechanisms. Verify network connectivity and check MyGeotab's status page for outages. Ensure your environment's proxy settings are correct if applicable.
No dependency data recorded yet.