Using with JavaScript

Notice from Geotab

On September 17, 2022, the current MyAdmin SDK site will be deprecated, and the MyAdmin SDK will be merged with the Geotab SDK site. Please ensure to update your relevant bookmarks as the site will be inaccessible after this date.


All communication with our services is done over HTTPS with data serialized in JSON format. A request consists of three properties:

id: -1 - this ID is ignored
method: '<method name>'
params: [parameters required by the method serialized as JSON]

Before calling any API methods, a call must be made to the Authenticate method to obtain the user’s API key and session ID. All method calls require a params object which contains the values for the parameters required by the methods. The following sections describe how to build the params object to authenticate and call an API method. The myAdminApi.js utility is provided to help with calling MyAdmin API methods. It can be downloaded here.

Step 1: Initialization & Authentication

The call to Authenticate is made as follows:

var apiKey,
    logonParams = {
        username: '',
        password: '<password>'
myAdminApi().call('Authenticate', logonParams, function(user) {
    apiKey = user.userId;
    sessionId = user.sessionId;

In the above example, the code passes the user name and password in the logonParams object and provides a callback function to be executed following a successful login. The callback function receives an ApiUser object which contains, among other properties, the user’s API key (userId) and session ID. See the Reference documentation for more information on the Authenticate method and the ApiUser object.

Step 2: Making Calls to Other Methods

Once authenticated, all other API methods can be called using the API key and Session ID obtained in the previous example. For example, the following code will return a list of available device plans:

var devicePlan
Params = {
    apiKey: apiKey,
    sessionId: sessionId
myAdminApi().call('GetDevicePlans', devicePlanParams, function(devicePlans) {
    // Do something with the array of ApiDevicePlan

The result object in the above code contains an array of ApiDevicePlan.

More information

For more information, see the JavaScript Examples section.