diff --git a/Gemfile.lock b/Gemfile.lock
index 34ec5294d..ab44813df 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -115,4 +115,4 @@ DEPENDENCIES
kramdown
BUNDLED WITH
- 1.17.2
+ 1.17.2
\ No newline at end of file
diff --git a/src/myadmin-sdk/api/MyAdminAPI.xml b/src/myadmin-sdk/api/MyAdminAPI.xml
new file mode 100644
index 000000000..95220767e
--- /dev/null
+++ b/src/myadmin-sdk/api/MyAdminAPI.xml
@@ -0,0 +1,997 @@
+
+
+
+ true
+
+ Summary description for MyAdminApi
+
+
+
+ true
+
+ Primary Interface Store for the MyAdminApi set.
+
+
+
+ true
+ MyAdminApiUser
+
+ Authenticates the user and returns the required API Key and Session ID, used for all subsequent API calls. If too
+ much time has elapsed between subsequent API calls, calling other methods will throw a SessionExpiredException. When this occurrs,
+ call Authenticate to obtain a new session ID.
+
+ Calls to this method will be rate limited. Ensure reauthentication is ONLY performed when a SessionExpiredException is thrown. Limit your calls to 500/min and 30000/hour.
+ Your existing MyAdmin User Name (email address).
+ Your existing MyAdmin User Password.
+ The active object that contains your API Key, which is required for all API calls.
+
+
+ true
+ MyAdminApiUser
+ User Admin
+ This group of methods allows the user to manage MyAdmin user accounts.
+
+ Registers a new user account into MyAdmin. An activation email will be sent to the user's email address.
+
+ The active API Key.
+ The active session ID.
+ The new users' email address.
+ The new users' password (min 5 characters).
+ String array of account numbers (see .Accounts and ) to be allocated to the user.
+ String array array of roles (see .Roles and ) to be allocated to the user.
+ UserType Id for (see .
+ Returns true when the user is successfully created, otherwise false.
+
+
+ true
+ MyAdminApiUser or MyAdminApiInstaller
+ Devices and Contracts
+ This group of methods allows the user to access information about devices and their associated contracts.
+
+ Returns current information relating to the device serial number provided.
+
+ The active API Key.
+ The active session ID.
+ A serial number of a Geotab GO device.
+ Returns an object that contains current, relevant information pertaining to the device.
+
+
+ true
+ MyAdminApiUser or MyAdminApiInstaller
+ Devices and Contracts
+ This group of methods allows the user to access information about devices and their associated contracts.
+
+ Logs a device installation and returns the status of the device.
+
+ The active API Key.
+ The active session ID.
+ Name of the installer logging the request.
+ Name of the installer's company.
+ A serial number of a Geotab GO device which has been installed.
+ Vehicle's current odometer reading.
+ Customer's asset number for the vehicle.
+ Any comments related to the installation.
+ Returns an object that contains current, relevant information pertaining to the device.
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Order Management
+
+ Returns an array of available to an account.
+
+ The active API Key.
+ The active session ID.
+ The account from which to retrieve the list of available products.
+ Product code to filter.
+ Array of available to the account.
+
+
+ true
+ MyAdminApiUser
+ Order Management
+
+ Returns an array of active , available to all assigned accounts.
+
+ The active API Key.
+ The active session ID.
+ Limits results to device plans available to the specified account.
+ Array of .
+
+
+ true
+ MyAdminApiUser
+ Order Management
+
+ Returns the user , associated with a given email account.
+
+ The active API Key.
+ The active session ID.
+ Limits result to the specific user associated with a known email.
+ Instance of object.
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Devices and Contracts
+
+ Returns an array of available warranty options.
+
+ The active API Key.
+ The active session ID.
+ Array of .
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Order Management
+ This group of methods allows the user to submit orders to Geotab.
+
+ Returns an array of shipping fees (used for Orders).
+
+ The active API Key.
+ The active session ID.
+ Filters list of shipping fees to the specified account.
+ Array of .
+
+
+ true
+ Devices and Contracts
+ MyAdminApiUser, Billing_Admin
+
+ Returns an array of . This method returns all contracts that are active within the specified date range, filtered based on other parameters.
+ If nextId is specified, the result set is limited to 1000 records. To obtain the first set of records, pass 0 into nextId. If the result set contains 1000 records,
+ call GetDeviceContracts again passing the Id of the last record in the current result set as the nextId parameter. This method returns device contracts that
+ are active during the specified date range.
+
+ The maximum date range is 60 days.
+ The active API Key.
+ The active session ID.
+ Account number (see .Accounts) for which to retrieve the device contracts.
+ Start of the date range (value in UTC).
+ End of the date range (value in UTC).
+ String array of device serial numbers to filter.
+ String array of device IMEI numbers to filter.
+ Array of third party ids
+ ID of the to filter. -1 = show all companies, 0 = show unassigned.
+ ID of the to filter. -1 = show all device plans, 0 = show unassigned.
+ Filter array by comment.
+ Filter for a specified purchase order number.
+ Includes device connection info.
+ Filters for devices that have never activated.
+ Filters for devices that are not registered in a MyGeotab database.
+ Filter array by groupId.
+ If specified, limits the result set to 1000 records and returns device contracts that have IDs greater than this value. To obtain the first limited result set, pass 0 as this value.
+ Retrieve only those devices that have a third party id
+ Array of .
+
+
+ true
+ Devices and Contracts
+ MyAdminApiUser, Device_Admin
+
+ Submits a request to change the billing plan () for the provided device.
+
+ This method does not support the Terminate plan (See for device terminations).
+ <br/><br/>
+ Note: When using the sandbox environment, this method will not affect live device configuration,
+ but the billing changes will be saved in the sandbox environment.
+
+
+ The active Api Key.
+ The active session ID.
+ A Geotab GO Device serial number.
+ An optional promo code, when applicable.
+ The new device plan ID. See to obtain a list of valid plans.
+ Indicates whether the provided serial number is an IMEI. If true, the serial number is an IMEI. If False or not specified, the serial number is a Geotab device serial number.
+ .
+
+
+ true
+ Devices and Contracts
+ MyAdminApiUser, Device_Admin
+
+ Submits a request to terminate a billing plan for the provided device.
+
+ The active Api Key.
+ The active session ID.
+ A Geotab GO Device serial number.
+ ID of the that the plan is being terminated. Call for a list of possible reasons.
+ A comment to add to the termination record.
+ Indicates whether the provided serial number is an IMEI. If true, the serial number is an IMEI. If False or not specified, the serial number is a Geotab device serial number.
+ .
+
+
+ false
+ Devices and Contracts
+ MyAdminApiUser, Device_Admin
+
+ Submits a request to terminate a billing plan for the provided device.
+
+ The active Api Key.
+ The active session ID.
+ Geotab GO Device serial numbers.
+ ID of the that the plan is being terminated. Call for a list of possible reasons.
+ List of .
+
+
+ true
+ Devices and Contracts
+ MyAdminApiUser, Device_Admin
+
+ Returns an array of that are possible reasons for termination.
+
+ The active Api Key.
+ The active session ID.
+ Array of .
+
+
+ true
+ Devices and Contracts
+ MyAdminApiUser, Device_Admin
+
+ Returns an array of that are possible reasons for termination.
+
+ The active Api Key.
+ The active session ID.
+ The primary termination request reason id for which to find secondary termination requests reasons.
+ Array of .
+
+
+ true
+ MyAdminApiUser, Device_Admin
+ Devices and Contracts
+
+ Gets the device contract request history for the given user and account.
+
+ The maximum date range is 60 days.
+ The active Api Key.
+ The active session ID.
+ Account number (see .Accounts) to retrieve contract request history from.
+ Array of device serial numbers to filter by.
+ Array of modem serial numbers (IMEIs) to filter by.
+ Customer company ID to filter by.
+ Start of the date range.
+ End of the date range.
+ Array of .
+
+
+ true
+ MyAdminApiUser, Device_Admin
+ Devices and Contracts
+
+ Updates the comment and/or user contact (eg. assigned customer) for one or more Device Contracts.
+
+ The active Api Key.
+ The active session ID.
+ Serial numbers of the Device Contracts to update.
+ True if comments are to be updated.
+ New comment if updateComments is true.
+ True if assigned User Contact is to be updated.
+ ID of the to assign to the Device Contracts if updateUserContact is true. See to obtain a list of User Contacts.
+ True if Active Tracking status for these devices should be changed as per activeTrackingDisallowed parameter, false to not update Active Tracking status.
+ True if Active Tracking should be disallowed, false if Active Tracking should be allowed. If updateActiveTracking is false or not specified, this parameter has no effect.
+ True if the GroupId for these devices should be changed as per groupId parameter, false to not update GroupId.
+ GroupId setting for these devices. If updateGroupId is false or not specified, this parameter has no effect. The group ID may be used by the API user to group or categorize devices for the user's convenience.
+ True if the PromoCode for these devices should be changed as per promoCode parameter, false to not update PromoCode.
+ PromoCode setting for these devices. If updatePromoCode is false or not specified, this parameter has no effect. Apply a valid promo code to the device(s).
+
+
+ true
+ MyAdminApiUser
+ Devices and Contracts
+
+ Gets an array of . The method returns all install logs that occurred
+ within the provided date range, filtered by the other parameters.
+
+ The maximum date range is 60 days.
+ The active API Key.
+ The active session ID.
+ Name of the installer to filter by.
+ Name of the company to filter by.
+ Device serial number to filter by.
+ Device asset number to filter by.
+ Start of the date range. This field is required if serialNoFilter is not specified.
+ End of the date range. This field is required if serialNoFilter is not specified.
+ Array of .
+
+
+ true
+ MyAdminApiUser
+ User Contact
+ This group of methods allows the user to manage user contact information.
+
+ Returns an array of for the API user, for the specified account.
+
+ The active API Key.
+ The active session ID.
+ Account number (see .Accounts) to retrieve user contacts from.
+ String to filter users from a particular company, otherwise .
+ Boolean value to show only active users, or not.
+ Array of if user and account are valid, or null if not.
+
+
+ true
+ MyAdminApiUser
+ User Contact
+
+ Adds or updates a user contact. The must contain a valid country name and where applicable,
+ a valid state name. Exceptions will be thrown if the country or state is invalid. A valid list of countries can be
+ retrieved by calling . A valid list of states for a country can be retrieved by calling
+ - if no states are returned, then any state name will be accepted for that country.
+ The parameter must contain a .
+ If the company does not already exist, the ID field should be set to 0 and a new company will be created. If the ID
+ is greater than zero, the existing company will be updated. The must contain a
+ with a valid account ID.
+
+ The active API Key.
+ The active session ID.
+ The to add or update.
+ The new or updated .
+
+
+ true
+ MyAdminApiUser
+ General
+
+ Finds a list of databases belonging to the specified account or all accounts associated with the calling user's accounts.
+
+ The active API Key.
+ The active session ID.
+ Filters the list of databases to the specified account. If omitted, all databases belonging to all of the user's accounts will be retrieved.
+ List of databases belonging to the user's accounts.
+
+
+ true
+ MyAdminApiUser, Device_Admin
+ Devices and Contracts
+
+ Returns an array of containing devices and their current databases and VINs (if available) for the specified account.
+ The result set is limited to 1000 records. If the result set contains 1000 records, call GetCurrentDeviceDatabases again passing the Id of the last record in
+ the current set as the nextId parameter.
+
+ The active API Key.
+ The active session ID.
+ The account to from which to retrieve the current list of device database.
+ If specified, returns device database records that have IDs greater than this value.
+ Array of .
+
+
+ true
+ MyAdminApiUser
+ Devices and Contracts
+
+ Returns an array of containing devices and their owner databases and shared databases (if available).
+
+ The active API Key.
+ The active session ID.
+ The array of serial numbers for which to retrieve thet list of owner and shared databases.
+ Array of .
+
+
+ true
+ MyAdminApiUser
+ Devices and Contracts
+
+ Returns an array of containing devices and their jurisdiction and dig url.
+
+ The active API Key.
+ The active session ID.
+ The array of serial numbers for which to retrieve jurisdiction.
+ Array of .
+
+
+ false
+
+ MyAdminApiUser, Device_Admin
+
+ The active API Key.
+ The active session ID.
+ The array of serial numbers to share or unshare.
+ The name or GUID of the database which owns the devices.
+ The name or GUID of the database to which the devices will be shared or unshared.
+ Indicates whether devices should be shared or unshared. True for share, False to unshare.
+
+
+ true
+ MyAdminApiUser
+ General
+
+ Returns a list of valid country names.
+
+ The active API Key.
+ The active session ID.
+ List of valid countries.
+
+
+ true
+ MyAdminApiUser
+ General
+
+ Returns an array of valid state names for a given country or an empty array if no states exist
+ for the country. Throws if an invalid country name is provided.
+
+ The active API Key.
+ The active session ID.
+ The country name for which to retrieve the list of states.
+ Array of valid state names for a given country or an empty array if no states exist for the country.
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Order Management
+
+ Posts a new order to MyAdmin. Create a with details of the order. Required fields are:<br/>
+ - devicePlanLevel<br/>
+ - forAccount<br/>
+ - orderItems<br/>
+ - purchaseOrderNo<br/>
+ - shipToId<br/>
+ - shippingFeeId<br/>
+ - warrantyOptionId<br/>
+ Note that an Order which contains OrderItems for which a Bulk Price exists may be adjusted for applicable Bulk Price discounts. To take advantage of these discounts, either post an order with the desired quantity at the normal purchase price (the discounts will be applied automatically) or post an order with exactly BulkPriceMinQuantity (see ) quantity at the normal purchase price, and any additional quantity using the BulkPrice. Other combinations of order items may result in errors.
+
+ The active API Key.
+ The active session ID.
+ The with details of the order.
+ The list of for install service products.
+ The list of for install service and keyless products.
+ Returns OrderId for order
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Order Management
+
+ Returns an array of containing status of orders.
+
+ The active API Key.
+ The active session ID.
+ Account where the order was created.
+ Filter by purchase order number.
+ Filter by reseller reference number.
+ Filter by Geotab order number.
+ If specified, retrieves orders with order dates greater than or equal to this value (value in UTC).
+ If specified, retrieves orders with order dates less than this value (value in UTC).
+ If true, only retrieve orders saved as planning orders.
+ Array of .
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Order Management
+
+ Cancels an order at anytime before or after completion. If the order has already shipped an RMA request will be automaticly generated and a returns of objects is return otherwise a null result is return.
+ If orderId is specified the order is canceled by orderId and forAccount, otherwise specify forAccount with purchaseOrderNo to cancel order.
+
+ The active API Key.
+ The active session ID.
+ The order Id to cancel for, otherwise .
+ Account to cancel order for
+ Filter by purchase order number, otherwise .
+ Object of or
+
+
+ true
+ MyAdminApiUser, Billing_Admin
+ Devices and Contracts
+
+ Returns an array of objects for the given period and filters.
+
+ The active API Key.
+ The active session ID.
+ Account to retrieve billing records for, otherwise .
+ Device serial number filter, otherwise .
+ The month number for the billing period (1 = January, 12 = December)
+ The 4-digit year for the billing period
+
+ This method is deprecated - Please use GetDeviceContractTransactions instead.
+
+ Array of objects for the given period and filters
+
+
+ true
+ MyAdminApiUser, Billing_Admin
+ Devices and Contracts
+
+ Returns an array of objects for the given period and filters. If nextId is specified, the result set is limited to 1000 records.
+ To obtain the first set of records, pass 0 into nextId. If the result set contains 1000 records, call GetDeviceContractTransactions again passing the Id of the last record in
+ the current result set as the nextId parameter.
+
+ The active API Key.
+ The active session ID.
+ Account to retrieve billing records for, otherwise .
+ Device serial number filter, otherwise .
+ The month number for the billing period (1 = January, 12 = December)
+ The 4-digit year for the billing period
+ If specified, returns transaction records that have IDs greater than this value.
+ Array of objects for the given period and filters
+
+
+ true
+ MyAdminApiUser, Billing_Admin
+ Devices and Contracts
+
+ Returns an array of objects for the given period and filters.
+
+ The active API Key.
+ The active session ID.
+ >Account to retrieve billing records for.
+ The month number for the billing period (1 = January, 12 = December)
+ The 4-digit year for the billing period
+ Array of objects for the given period and filters
+
+
+ true
+ MyAdminApiUser, RMAViewOnly
+ RMA
+ This group of methods allows the user to submit RMA requests and view the status of existing RMA Requests and RMAs.
+
+ Gets an array of active for the specified account.
+
+ The active API Key.
+ The active session ID.
+ The account to retrieve RMA requests for.
+ Array of of active RMA requests.
+
+
+ true
+ MyAdminApiUser, RMAViewOnly
+ RMA
+
+ Gets an array of devices () that belong to a .
+
+ The active API Key.
+ The active session ID.
+ The account the RMA request belongs to.
+ The ID of the RMA request to retrieve the list of items for.
+ Array of .
+
+
+ true
+ MyAdminApiUser, RMAViewOnly
+ RMA
+
+ Gets an array of for the specified account. If no deviceFilter or resellerReferenceFilter are
+ specified, the method returns all active RMAs in the account. If a deviceFilter or resellerReferenceFilter are specified,
+ the method returns the RMA(s) matching the filter(s), regardless of active status.
+
+ The active API Key.
+ The active session ID.
+ The account from which to retrieve RMA.
+ Device serial number to search.
+ Reseller reference number/code to search.
+ Array of .
+
+
+ true
+ MyAdminApiUser, RMARequestCreate
+ RMA
+
+ Creates an RMA request and returns a .
+
+ The itemsForRepair, reasonsForRepair, and quantitiesForRepair arrays must contain the same number of elements (eg. one reason and quantity per item).
+ All devices should have their quantity set to one.
+ The active API Key.
+ The active session ID.
+ The account under which the RMA request will be created.
+ ID of the whose address will be associated with the RMA.
+ The ID of the associated with the RMA request. If no caseNo is provided, a new case will be created.
+ Comments related to the RMA request.
+ Reseller reference number/code.
+ String array of device serial numbers or product codes to be repaired.
+ String array of reasons for each product to be repaired. For Sales Returns, pass in the name.
+ Int array of quantities for each product to be repaired.
+ ID of the .
+ The that was created.
+
+
+ true
+ MyAdminApiUser
+ RMA
+
+ Returns a list of used for Sales Return RMAs.
+
+ The active API Key.
+ The active session ID.
+ List of used for Sales Return RMAs.
+
+
+ true
+ MyAdminApiUser
+ RMA
+
+ Returns a list of .
+
+ The active API Key.
+ The active session ID.
+ List of
+
+
+ true
+ MyAdminApiUser, RMAViewOnly
+ RMA
+
+ Returns a list of .
+
+ The active API Key.
+ The active session ID.
+ Account to look for required RMA.
+ List of Serial Numbers to look for required RMA.
+ List of
+
+
+ true
+ MyAdminApiUser
+ Vin LookUp
+
+ Gets all details of vehicles with option to include engine data. Returns a list of .
+
+ The Vin Decoder only supports North American vehicles at this time. Please submit a support ticket if you require assistance for vehicles in other regions.
+ Geotab cannot guarantee the accuracy of this information.If you find this information to be incorrect, please contact Geotab Support
+ The active API Key.
+ The active session ID.
+ Vehicle Vin numbers
+ include engine data
+ A list of .
+
+
+ true
+ MyAdminApiUser
+ Vin LookUp
+
+ Gets all details of vehicles with option to include engine data. Returns a list of .
+
+ The Vin Decoder only supports North American vehicles at this time. Please submit a support ticket if you require assistance for vehicles in other regions.
+ Geotab cannot guarantee the accuracy of this information.If you find this information to be incorrect, please contact Geotab Support
+ The active API Key.
+ The active session ID.
+ Make of vehicle
+ vehicle model
+ Year of vehicle
+ include engine data
+ A list of.
+
+
+ false
+ Third-Party-Integrator
+
+ This method is marked as unsupported so that we can separate the new and legacy versions into two different methods
+ in the documentation.
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ Third Party Integration
+
+ This group of methods allows the user to manage third party devices and their data. These methods are only available to third-party
+ integrators. In addition to the MyAdminApiLib, a reference must be added to Geotab.Checkmate.ObjectModel.dll.
+
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+
+ Provisions a device to an account.
+
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+ The active API Key.
+ The active session ID.
+ Product ID to provision.
+ Account number for new activation.
+ Promo Code for third-party device
+ Subscription Plan to provision OEM devices
+ A if provision was successful, null if not.
+
+
+ false
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Provisions a device to an account.
+
+
+ This method is deprecated - Use version of ProvisionDeviceToAccount which takes API Key and Session ID.
+ <br/><br/>
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+
+ Username of a valid Third Party Integrator user.
+ Password for user.
+ Product ID to provision.
+ Account number for new activation.
+ Promo Code for third-party device
+ Subscription Plan to provision OEM devices
+ A if provision was successful, null if not.
+
+
+ false
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Provisions a device to the user's default account.
+
+ Username of a valid Third Party Integrator user.
+ Password for user.
+ The active API Key.
+ The active session ID.
+ Product ID to provision.
+ Promo Code for third-party device
+ Subscription Plan to provision OEM devices
+ A if provision was successful, null if not.
+
+
+ true
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Provisions a device to the user's default account.
+
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+ The active API Key.
+ The active session ID.
+ Product ID to provision.
+ Promo Code for third-party device
+ Subscription Plan to provision OEM devices
+ A if provision was successful, null if not.
+
+
+ false
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Provisions a device to the user's default account.
+
+
+ This method is deprecated - Use version of ProvisionDevice which takes API Key and Session ID
+ <br/><br/>
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+
+ Username of a valid Third Party Integrator user.
+ Password for user.
+ Product ID to provision.
+ Promo Code for third-party device
+ Subscription Plan to provision OEM devices
+ A if provision was successful, null if not.
+
+
+ true
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Adds a set of third-party GPS records into the Geotab database.
+
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+ The active API Key.
+ The active session ID.
+ List of to add to the database.
+ List of .
+
+
+ false
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Adds a set of third-party GPS records into the Geotab database.
+
+ Username of a valid Third Party Integrator user.
+ Password for user.
+ The active API Key.
+ The active session ID.
+ List of to add to the database.
+ List of .
+
+
+ true
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Adds a set of third-party GPS records into the Geotab database.
+
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+ The active API Key.
+ The active session ID.
+ List of to add to the database.
+ List of .
+
+
+ false
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Adds a set of third-party GPS records into the Geotab database.
+
+
+ This method is deprecated - Use version of AddGps which takes API Key and Session ID.
+ <br/><br/>
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+
+ Username of a valid Third Party Integrator user.
+ Password for user.
+ List of to add to the database.
+ List of .
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Order Management
+
+ Returns an array of containing status of orders.
+
+ The active API Key.
+ The active session ID.
+ Account where the order was created.
+ Filter by purchase order number.
+ If specified, include carrier info.
+ Array of .
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+ This group of methods allows the user to interact with Geotab's help desk.
+
+ Get Single Ticket from MyAdmin Helpdesk By TicketId and Account Number
+
+
+ Account Number, Subject, Description, Type (Issue/Inquiry) are required.
+
+ The active API Key.
+ The active session ID.
+ The Account Number that the tickets belong to
+ The requested Ticket Number, must be under the requested account
+ ApiHelpdeskTicket Object
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Get all tickets from MyAdmin Helpdesk By Account Number
+
+ The active API Key.
+ The active session ID.
+ The Account Number that the tickets belong to
+ Filter result by ticket number or ticket title
+ Only return tickets that the status is open, default is true
+ Only return tickets that the status is closed, default is false
+ Include tickets from everyone under the account, default is false
+ Only return archived tickets, default is false
+ Only return tickets created after startDate
+ Only return tickets created before endDate
+ Array of ApiHelpdeskTicket
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Create a new Helpdesk Ticket
+
+ The active API Key.
+ The active session ID.
+ The to be created MyAdmin Helpdesk Ticket Object
+ Ticket Id
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Update an existing Helpdesk Ticket
+
+ The active API Key.
+ The active session ID.
+ The delta change of the Ticket Object
+ Ticket Number
+ Request to close the ticket, default is false
+ Ticket Id
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Get a single comment of an Helpdesk Ticket
+
+ The active API Key.
+ The active session ID.
+ The requested Ticket Number, must be under the requested account
+ The comment Id that belongs to the requested Ticket
+ ApiHelpdeskComment
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Get all comments of an Helpdesk Ticket
+
+ The active API Key.
+ The active session ID.
+ The requested Ticket Number, must be under the requested account
+ Array of ApiHelpdeskComment
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Create a new comment of an Helpdesk Ticket
+
+ The active API Key.
+ The active session ID.
+ The to be created Comment object of the Ticket
+ /// The ticket Id of the comment
+ Comment Id
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Get a single Helpdesk Attachment Object in the comment of the ticket
+
+ The active API Key.
+ The active session ID.
+ The requested Ticket Number, must be under the requested account
+ The comment Id that belongs to the requested Ticket
+ The Attachment Id under a comment of the ticket
+ ApiHelpdeskAttachment
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Get all Helpdesk Attachment Object in the comment of the ticket
+
+ The active API Key.
+ The active session ID.
+ The requested Ticket Number, must be under the requested account
+ The comment Id that belongs to the requested Ticket
+ Array of ApiHehlpdeskAttachment
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Create a Helpdesk Attachment Object in the comment of the ticket
+
+ The active API Key.
+ The active session ID.
+ The requested Ticket Number, must be under the requested account
+ Comment Id of the Ticket
+ The to be created Attachment Object
+ Attachment Id
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Get the byte array of the Attachment
+
+ The active API Key.
+ The active session ID.
+ The requested Ticket Number, must be under the requested account
+ The comment Id that belongs to the requested Ticket
+ The Attachment Id under a comment of the ticket
+ Binary of the file
+
+
diff --git a/src/myadmin-sdk/api/MyAdminAPIOriginal.xml b/src/myadmin-sdk/api/MyAdminAPIOriginal.xml
new file mode 100644
index 000000000..13a093548
--- /dev/null
+++ b/src/myadmin-sdk/api/MyAdminAPIOriginal.xml
@@ -0,0 +1,1002 @@
+
+
+
+ MyAdminAPI
+
+
+
+ true
+
+ Summary description for MyAdminApi
+
+
+
+ true
+
+ Primary Interface Store for the MyAdminApi set.
+
+
+
+ true
+ MyAdminApiUser
+
+ Authenticates the user and returns the required API Key and Session ID, used for all subsequent API calls. If too
+ much time has elapsed between subsequent API calls, calling other methods will throw a SessionExpiredException. When this occurrs,
+ call Authenticate to obtain a new session ID.
+
+ Calls to this method will be rate limited. Ensure reauthentication is ONLY performed when a SessionExpiredException is thrown. Limit your calls to 500/min and 30000/hour.
+ Your existing MyAdmin User Name (email address).
+ Your existing MyAdmin User Password.
+ The active object that contains your API Key, which is required for all API calls.
+
+
+ true
+ MyAdminApiUser
+ User Admin
+ This group of methods allows the user to manage MyAdmin user accounts.
+
+ Registers a new user account into MyAdmin. An activation email will be sent to the user's email address.
+
+ The active API Key.
+ The active session ID.
+ The new users' email address.
+ The new users' password (min 5 characters).
+ String array of account numbers (see .Accounts and ) to be allocated to the user.
+ String array array of roles (see .Roles and ) to be allocated to the user.
+ UserType Id for (see .
+ Returns true when the user is successfully created, otherwise false.
+
+
+ true
+ MyAdminApiUser or MyAdminApiInstaller
+ Devices and Contracts
+ This group of methods allows the user to access information about devices and their associated contracts.
+
+ Returns current information relating to the device serial number provided.
+
+ The active API Key.
+ The active session ID.
+ A serial number of a Geotab GO device.
+ Returns an object that contains current, relevant information pertaining to the device.
+
+
+ true
+ MyAdminApiUser or MyAdminApiInstaller
+ Devices and Contracts
+ This group of methods allows the user to access information about devices and their associated contracts.
+
+ Logs a device installation and returns the status of the device.
+
+ The active API Key.
+ The active session ID.
+ Name of the installer logging the request.
+ Name of the installer's company.
+ A serial number of a Geotab GO device which has been installed.
+ Vehicle's current odometer reading.
+ Customer's asset number for the vehicle.
+ Any comments related to the installation.
+ Returns an object that contains current, relevant information pertaining to the device.
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Order Management
+
+ Returns an array of available to an account.
+
+ The active API Key.
+ The active session ID.
+ The account from which to retrieve the list of available products.
+ Product code to filter.
+ Array of available to the account.
+
+
+ true
+ MyAdminApiUser
+ Order Management
+
+ Returns an array of active , available to all assigned accounts.
+
+ The active API Key.
+ The active session ID.
+ Limits results to device plans available to the specified account.
+ Array of .
+
+
+ true
+ MyAdminApiUser
+ Order Management
+
+ Returns the user , associated with a given email account.
+
+ The active API Key.
+ The active session ID.
+ Limits result to the specific user associated with a known email.
+ Instance of object.
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Devices and Contracts
+
+ Returns an array of available warranty options.
+
+ The active API Key.
+ The active session ID.
+ Array of .
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Order Management
+ This group of methods allows the user to submit orders to Geotab.
+
+ Returns an array of shipping fees (used for Orders).
+
+ The active API Key.
+ The active session ID.
+ Filters list of shipping fees to the specified account.
+ Array of .
+
+
+ true
+ Devices and Contracts
+ MyAdminApiUser, Billing_Admin
+
+ Returns an array of . This method returns all contracts that are active within the specified date range, filtered based on other parameters.
+ If nextId is specified, the result set is limited to 1000 records. To obtain the first set of records, pass 0 into nextId. If the result set contains 1000 records,
+ call GetDeviceContracts again passing the Id of the last record in the current result set as the nextId parameter. This method returns device contracts that
+ are active during the specified date range.
+
+ The maximum date range is 60 days.
+ The active API Key.
+ The active session ID.
+ Account number (see .Accounts) for which to retrieve the device contracts.
+ Start of the date range (value in UTC).
+ End of the date range (value in UTC).
+ String array of device serial numbers to filter.
+ String array of device IMEI numbers to filter.
+ Array of third party ids
+ ID of the to filter. -1 = show all companies, 0 = show unassigned.
+ ID of the to filter. -1 = show all device plans, 0 = show unassigned.
+ Filter array by comment.
+ Filter for a specified purchase order number.
+ Includes device connection info.
+ Filters for devices that have never activated.
+ Filters for devices that are not registered in a MyGeotab database.
+ Filter array by groupId.
+ If specified, limits the result set to 1000 records and returns device contracts that have IDs greater than this value. To obtain the first limited result set, pass 0 as this value.
+ Retrieve only those devices that have a third party id
+ Array of .
+
+
+ true
+ Devices and Contracts
+ MyAdminApiUser, Device_Admin
+
+ Submits a request to change the billing plan () for the provided device.
+
+ This method does not support the Terminate plan (See for device terminations).
+ <br/><br/>
+ Note: When using the sandbox environment, this method will not affect live device configuration,
+ but the billing changes will be saved in the sandbox environment.
+
+
+ The active Api Key.
+ The active session ID.
+ A Geotab GO Device serial number.
+ An optional promo code, when applicable.
+ The new device plan ID. See to obtain a list of valid plans.
+ Indicates whether the provided serial number is an IMEI. If true, the serial number is an IMEI. If False or not specified, the serial number is a Geotab device serial number.
+ .
+
+
+ true
+ Devices and Contracts
+ MyAdminApiUser, Device_Admin
+
+ Submits a request to terminate a billing plan for the provided device.
+
+ The active Api Key.
+ The active session ID.
+ A Geotab GO Device serial number.
+ ID of the that the plan is being terminated. Call for a list of possible reasons.
+ A comment to add to the termination record.
+ Indicates whether the provided serial number is an IMEI. If true, the serial number is an IMEI. If False or not specified, the serial number is a Geotab device serial number.
+ .
+
+
+ false
+ Devices and Contracts
+ MyAdminApiUser, Device_Admin
+
+ Submits a request to terminate a billing plan for the provided device.
+
+ The active Api Key.
+ The active session ID.
+ Geotab GO Device serial numbers.
+ ID of the that the plan is being terminated. Call for a list of possible reasons.
+ List of .
+
+
+ true
+ Devices and Contracts
+ MyAdminApiUser, Device_Admin
+
+ Returns an array of that are possible reasons for termination.
+
+ The active Api Key.
+ The active session ID.
+ Array of .
+
+
+ true
+ Devices and Contracts
+ MyAdminApiUser, Device_Admin
+
+ Returns an array of that are possible reasons for termination.
+
+ The active Api Key.
+ The active session ID.
+ The primary termination request reason id for which to find secondary termination requests reasons.
+ Array of .
+
+
+ true
+ MyAdminApiUser, Device_Admin
+ Devices and Contracts
+
+ Gets the device contract request history for the given user and account.
+
+ The maximum date range is 60 days.
+ The active Api Key.
+ The active session ID.
+ Account number (see .Accounts) to retrieve contract request history from.
+ Array of device serial numbers to filter by.
+ Array of modem serial numbers (IMEIs) to filter by.
+ Customer company ID to filter by.
+ Start of the date range.
+ End of the date range.
+ Array of .
+
+
+ true
+ MyAdminApiUser, Device_Admin
+ Devices and Contracts
+
+ Updates the comment and/or user contact (eg. assigned customer) for one or more Device Contracts.
+
+ The active Api Key.
+ The active session ID.
+ Serial numbers of the Device Contracts to update.
+ True if comments are to be updated.
+ New comment if updateComments is true.
+ True if assigned User Contact is to be updated.
+ ID of the to assign to the Device Contracts if updateUserContact is true. See to obtain a list of User Contacts.
+ True if Active Tracking status for these devices should be changed as per activeTrackingDisallowed parameter, false to not update Active Tracking status.
+ True if Active Tracking should be disallowed, false if Active Tracking should be allowed. If updateActiveTracking is false or not specified, this parameter has no effect.
+ True if the GroupId for these devices should be changed as per groupId parameter, false to not update GroupId.
+ GroupId setting for these devices. If updateGroupId is false or not specified, this parameter has no effect. The group ID may be used by the API user to group or categorize devices for the user's convenience.
+ True if the PromoCode for these devices should be changed as per promoCode parameter, false to not update PromoCode.
+ PromoCode setting for these devices. If updatePromoCode is false or not specified, this parameter has no effect. Apply a valid promo code to the device(s).
+
+
+ true
+ MyAdminApiUser
+ Devices and Contracts
+
+ Gets an array of . The method returns all install logs that occurred
+ within the provided date range, filtered by the other parameters.
+
+ The maximum date range is 60 days.
+ The active API Key.
+ The active session ID.
+ Name of the installer to filter by.
+ Name of the company to filter by.
+ Device serial number to filter by.
+ Device asset number to filter by.
+ Start of the date range. This field is required if serialNoFilter is not specified.
+ End of the date range. This field is required if serialNoFilter is not specified.
+ Array of .
+
+
+ true
+ MyAdminApiUser
+ User Contact
+ This group of methods allows the user to manage user contact information.
+
+ Returns an array of for the API user, for the specified account.
+
+ The active API Key.
+ The active session ID.
+ Account number (see .Accounts) to retrieve user contacts from.
+ String to filter users from a particular company, otherwise .
+ Boolean value to show only active users, or not.
+ Array of if user and account are valid, or null if not.
+
+
+ true
+ MyAdminApiUser
+ User Contact
+
+ Adds or updates a user contact. The must contain a valid country name and where applicable,
+ a valid state name. Exceptions will be thrown if the country or state is invalid. A valid list of countries can be
+ retrieved by calling . A valid list of states for a country can be retrieved by calling
+ - if no states are returned, then any state name will be accepted for that country.
+ The parameter must contain a .
+ If the company does not already exist, the ID field should be set to 0 and a new company will be created. If the ID
+ is greater than zero, the existing company will be updated. The must contain a
+ with a valid account ID.
+
+ The active API Key.
+ The active session ID.
+ The to add or update.
+ The new or updated .
+
+
+ true
+ MyAdminApiUser
+ General
+
+ Finds a list of databases belonging to the specified account or all accounts associated with the calling user's accounts.
+
+ The active API Key.
+ The active session ID.
+ Filters the list of databases to the specified account. If omitted, all databases belonging to all of the user's accounts will be retrieved.
+ List of databases belonging to the user's accounts.
+
+
+ true
+ MyAdminApiUser, Device_Admin
+ Devices and Contracts
+
+ Returns an array of containing devices and their current databases and VINs (if available) for the specified account.
+ The result set is limited to 1000 records. If the result set contains 1000 records, call GetCurrentDeviceDatabases again passing the Id of the last record in
+ the current set as the nextId parameter.
+
+ The active API Key.
+ The active session ID.
+ The account to from which to retrieve the current list of device database.
+ If specified, returns device database records that have IDs greater than this value.
+ Array of .
+
+
+ true
+ MyAdminApiUser
+ Devices and Contracts
+
+ Returns an array of containing devices and their owner databases and shared databases (if available).
+
+ The active API Key.
+ The active session ID.
+ The array of serial numbers for which to retrieve thet list of owner and shared databases.
+ Array of .
+
+
+ true
+ MyAdminApiUser
+ Devices and Contracts
+
+ Returns an array of containing devices and their jurisdiction and dig url.
+
+ The active API Key.
+ The active session ID.
+ The array of serial numbers for which to retrieve jurisdiction.
+ Array of .
+
+
+ false
+
+ MyAdminApiUser, Device_Admin
+
+ The active API Key.
+ The active session ID.
+ The array of serial numbers to share or unshare.
+ The name or GUID of the database which owns the devices.
+ The name or GUID of the database to which the devices will be shared or unshared.
+ Indicates whether devices should be shared or unshared. True for share, False to unshare.
+
+
+ true
+ MyAdminApiUser
+ General
+
+ Returns a list of valid country names.
+
+ The active API Key.
+ The active session ID.
+ List of valid countries.
+
+
+ true
+ MyAdminApiUser
+ General
+
+ Returns an array of valid state names for a given country or an empty array if no states exist
+ for the country. Throws if an invalid country name is provided.
+
+ The active API Key.
+ The active session ID.
+ The country name for which to retrieve the list of states.
+ Array of valid state names for a given country or an empty array if no states exist for the country.
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Order Management
+
+ Posts a new order to MyAdmin. Create a with details of the order. Required fields are:<br/>
+ - devicePlanLevel<br/>
+ - forAccount<br/>
+ - orderItems<br/>
+ - purchaseOrderNo<br/>
+ - shipToId<br/>
+ - shippingFeeId<br/>
+ - warrantyOptionId<br/>
+ Note that an Order which contains OrderItems for which a Bulk Price exists may be adjusted for applicable Bulk Price discounts. To take advantage of these discounts, either post an order with the desired quantity at the normal purchase price (the discounts will be applied automatically) or post an order with exactly BulkPriceMinQuantity (see ) quantity at the normal purchase price, and any additional quantity using the BulkPrice. Other combinations of order items may result in errors.
+
+ The active API Key.
+ The active session ID.
+ The with details of the order.
+ The list of for install service products.
+ The list of for install service and keyless products.
+ Returns OrderId for order
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Order Management
+
+ Returns an array of containing status of orders.
+
+ The active API Key.
+ The active session ID.
+ Account where the order was created.
+ Filter by purchase order number.
+ Filter by reseller reference number.
+ Filter by Geotab order number.
+ If specified, retrieves orders with order dates greater than or equal to this value (value in UTC).
+ If specified, retrieves orders with order dates less than this value (value in UTC).
+ If true, only retrieve orders saved as planning orders.
+ Array of .
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Order Management
+
+ Cancels an order at anytime before or after completion. If the order has already shipped an RMA request will be automaticly generated and a returns of objects is return otherwise a null result is return.
+ If orderId is specified the order is canceled by orderId and forAccount, otherwise specify forAccount with purchaseOrderNo to cancel order.
+
+ The active API Key.
+ The active session ID.
+ The order Id to cancel for, otherwise .
+ Account to cancel order for
+ Filter by purchase order number, otherwise .
+ Object of or
+
+
+ true
+ MyAdminApiUser, Billing_Admin
+ Devices and Contracts
+
+ Returns an array of objects for the given period and filters.
+
+ The active API Key.
+ The active session ID.
+ Account to retrieve billing records for, otherwise .
+ Device serial number filter, otherwise .
+ The month number for the billing period (1 = January, 12 = December)
+ The 4-digit year for the billing period
+
+ This method is deprecated - Please use GetDeviceContractTransactions instead.
+
+ Array of objects for the given period and filters
+
+
+ true
+ MyAdminApiUser, Billing_Admin
+ Devices and Contracts
+
+ Returns an array of objects for the given period and filters. If nextId is specified, the result set is limited to 1000 records.
+ To obtain the first set of records, pass 0 into nextId. If the result set contains 1000 records, call GetDeviceContractTransactions again passing the Id of the last record in
+ the current result set as the nextId parameter.
+
+ The active API Key.
+ The active session ID.
+ Account to retrieve billing records for, otherwise .
+ Device serial number filter, otherwise .
+ The month number for the billing period (1 = January, 12 = December)
+ The 4-digit year for the billing period
+ If specified, returns transaction records that have IDs greater than this value.
+ Array of objects for the given period and filters
+
+
+ true
+ MyAdminApiUser, Billing_Admin
+ Devices and Contracts
+
+ Returns an array of objects for the given period and filters.
+
+ The active API Key.
+ The active session ID.
+ >Account to retrieve billing records for.
+ The month number for the billing period (1 = January, 12 = December)
+ The 4-digit year for the billing period
+ Array of objects for the given period and filters
+
+
+ true
+ MyAdminApiUser, RMAViewOnly
+ RMA
+ This group of methods allows the user to submit RMA requests and view the status of existing RMA Requests and RMAs.
+
+ Gets an array of active for the specified account.
+
+ The active API Key.
+ The active session ID.
+ The account to retrieve RMA requests for.
+ Array of of active RMA requests.
+
+
+ true
+ MyAdminApiUser, RMAViewOnly
+ RMA
+
+ Gets an array of devices () that belong to a .
+
+ The active API Key.
+ The active session ID.
+ The account the RMA request belongs to.
+ The ID of the RMA request to retrieve the list of items for.
+ Array of .
+
+
+ true
+ MyAdminApiUser, RMAViewOnly
+ RMA
+
+ Gets an array of for the specified account. If no deviceFilter or resellerReferenceFilter are
+ specified, the method returns all active RMAs in the account. If a deviceFilter or resellerReferenceFilter are specified,
+ the method returns the RMA(s) matching the filter(s), regardless of active status.
+
+ The active API Key.
+ The active session ID.
+ The account from which to retrieve RMA.
+ Device serial number to search.
+ Reseller reference number/code to search.
+ Array of .
+
+
+ true
+ MyAdminApiUser, RMARequestCreate
+ RMA
+
+ Creates an RMA request and returns a .
+
+ The itemsForRepair, reasonsForRepair, and quantitiesForRepair arrays must contain the same number of elements (eg. one reason and quantity per item).
+ All devices should have their quantity set to one.
+ The active API Key.
+ The active session ID.
+ The account under which the RMA request will be created.
+ ID of the whose address will be associated with the RMA.
+ The ID of the associated with the RMA request. If no caseNo is provided, a new case will be created.
+ Comments related to the RMA request.
+ Reseller reference number/code.
+ String array of device serial numbers or product codes to be repaired.
+ String array of reasons for each product to be repaired. For Sales Returns, pass in the name.
+ Int array of quantities for each product to be repaired.
+ ID of the .
+ The that was created.
+
+
+ true
+ MyAdminApiUser
+ RMA
+
+ Returns a list of used for Sales Return RMAs.
+
+ The active API Key.
+ The active session ID.
+ List of used for Sales Return RMAs.
+
+
+ true
+ MyAdminApiUser
+ RMA
+
+ Returns a list of .
+
+ The active API Key.
+ The active session ID.
+ List of
+
+
+ true
+ MyAdminApiUser, RMAViewOnly
+ RMA
+
+ Returns a list of .
+
+ The active API Key.
+ The active session ID.
+ Account to look for required RMA.
+ List of Serial Numbers to look for required RMA.
+ List of
+
+
+ true
+ MyAdminApiUser
+ Vin LookUp
+
+ Gets all details of vehicles with option to include engine data. Returns a list of .
+
+ The Vin Decoder only supports North American vehicles at this time. Please submit a support ticket if you require assistance for vehicles in other regions.
+ Geotab cannot guarantee the accuracy of this information.If you find this information to be incorrect, please contact Geotab Support
+ The active API Key.
+ The active session ID.
+ Vehicle Vin numbers
+ include engine data
+ A list of .
+
+
+ true
+ MyAdminApiUser
+ Vin LookUp
+
+ Gets all details of vehicles with option to include engine data. Returns a list of .
+
+ The Vin Decoder only supports North American vehicles at this time. Please submit a support ticket if you require assistance for vehicles in other regions.
+ Geotab cannot guarantee the accuracy of this information.If you find this information to be incorrect, please contact Geotab Support
+ The active API Key.
+ The active session ID.
+ Make of vehicle
+ vehicle model
+ Year of vehicle
+ include engine data
+ A list of.
+
+
+ false
+ Third-Party-Integrator
+
+ This method is marked as unsupported so that we can separate the new and legacy versions into two different methods
+ in the documentation.
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ Third Party Integration
+
+ This group of methods allows the user to manage third party devices and their data. These methods are only available to third-party
+ integrators. In addition to the MyAdminApiLib, a reference must be added to Geotab.Checkmate.ObjectModel.dll.
+
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+
+ Provisions a device to an account.
+
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+ The active API Key.
+ The active session ID.
+ Product ID to provision.
+ Account number for new activation.
+ Promo Code for third-party device
+ Subscription Plan to provision OEM devices
+ A if provision was successful, null if not.
+
+
+ false
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Provisions a device to an account.
+
+
+ This method is deprecated - Use version of ProvisionDeviceToAccount which takes API Key and Session ID.
+ <br/><br/>
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+
+ Username of a valid Third Party Integrator user.
+ Password for user.
+ Product ID to provision.
+ Account number for new activation.
+ Promo Code for third-party device
+ Subscription Plan to provision OEM devices
+ A if provision was successful, null if not.
+
+
+ false
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Provisions a device to the user's default account.
+
+ Username of a valid Third Party Integrator user.
+ Password for user.
+ The active API Key.
+ The active session ID.
+ Product ID to provision.
+ Promo Code for third-party device
+ Subscription Plan to provision OEM devices
+ A if provision was successful, null if not.
+
+
+ true
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Provisions a device to the user's default account.
+
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+ The active API Key.
+ The active session ID.
+ Product ID to provision.
+ Promo Code for third-party device
+ Subscription Plan to provision OEM devices
+ A if provision was successful, null if not.
+
+
+ false
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Provisions a device to the user's default account.
+
+
+ This method is deprecated - Use version of ProvisionDevice which takes API Key and Session ID
+ <br/><br/>
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+
+ Username of a valid Third Party Integrator user.
+ Password for user.
+ Product ID to provision.
+ Promo Code for third-party device
+ Subscription Plan to provision OEM devices
+ A if provision was successful, null if not.
+
+
+ true
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Adds a set of third-party GPS records into the Geotab database.
+
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+ The active API Key.
+ The active session ID.
+ List of to add to the database.
+ List of .
+
+
+ false
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Adds a set of third-party GPS records into the Geotab database.
+
+ Username of a valid Third Party Integrator user.
+ Password for user.
+ The active API Key.
+ The active session ID.
+ List of to add to the database.
+ List of .
+
+
+ true
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Adds a set of third-party GPS records into the Geotab database.
+
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+ The active API Key.
+ The active session ID.
+ List of to add to the database.
+ List of .
+
+
+ false
+ Third-Party-Integrator
+ MyAdminApiUser, Third-Party-Integrator
+ Third Party Integration
+
+ Adds a set of third-party GPS records into the Geotab database.
+
+
+ This method is deprecated - Use version of AddGps which takes API Key and Session ID.
+ <br/><br/>
+ Note: This method cannot be called in the sandbox environment and will throw an exception.
+
+ Username of a valid Third Party Integrator user.
+ Password for user.
+ List of to add to the database.
+ List of .
+
+
+ true
+ MyAdminApiUser, Order_Admin
+ Order Management
+
+ Returns an array of containing status of orders.
+
+ The active API Key.
+ The active session ID.
+ Account where the order was created.
+ Filter by purchase order number.
+ If specified, include carrier info.
+ Array of .
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+ This group of methods allows the user to interact with Geotab's help desk.
+
+ Get Single Ticket from MyAdmin Helpdesk By TicketId and Account Number
+
+
+ Account Number, Subject, Description, Type (Issue/Inquiry) are required.
+
+ The active API Key.
+ The active session ID.
+ The Account Number that the tickets belong to
+ The requested Ticket Number, must be under the requested account
+ ApiHelpdeskTicket Object
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Get all tickets from MyAdmin Helpdesk By Account Number
+
+ The active API Key.
+ The active session ID.
+ The Account Number that the tickets belong to
+ Filter result by ticket number or ticket title
+ Only return tickets that the status is open, default is true
+ Only return tickets that the status is closed, default is false
+ Include tickets from everyone under the account, default is false
+ Only return archived tickets, default is false
+ Only return tickets created after startDate
+ Only return tickets created before endDate
+ Array of ApiHelpdeskTicket
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Create a new Helpdesk Ticket
+
+ The active API Key.
+ The active session ID.
+ The to be created MyAdmin Helpdesk Ticket Object
+ Ticket Id
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Update an existing Helpdesk Ticket
+
+ The active API Key.
+ The active session ID.
+ The delta change of the Ticket Object
+ Ticket Number
+ Request to close the ticket, default is false
+ Ticket Id
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Get a single comment of an Helpdesk Ticket
+
+ The active API Key.
+ The active session ID.
+ The requested Ticket Number, must be under the requested account
+ The comment Id that belongs to the requested Ticket
+ ApiHelpdeskComment
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Get all comments of an Helpdesk Ticket
+
+ The active API Key.
+ The active session ID.
+ The requested Ticket Number, must be under the requested account
+ Array of ApiHelpdeskComment
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Create a new comment of an Helpdesk Ticket
+
+ The active API Key.
+ The active session ID.
+ The to be created Comment object of the Ticket
+ /// The ticket Id of the comment
+ Comment Id
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Get a single Helpdesk Attachment Object in the comment of the ticket
+
+ The active API Key.
+ The active session ID.
+ The requested Ticket Number, must be under the requested account
+ The comment Id that belongs to the requested Ticket
+ The Attachment Id under a comment of the ticket
+ ApiHelpdeskAttachment
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Get all Helpdesk Attachment Object in the comment of the ticket
+
+ The active API Key.
+ The active session ID.
+ The requested Ticket Number, must be under the requested account
+ The comment Id that belongs to the requested Ticket
+ Array of ApiHehlpdeskAttachment
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Create a Helpdesk Attachment Object in the comment of the ticket
+
+ The active API Key.
+ The active session ID.
+ The requested Ticket Number, must be under the requested account
+ Comment Id of the Ticket
+ The to be created Attachment Object
+ Attachment Id
+
+
+ true
+ MyAdminApiUser
+ Help Desk
+
+ Get the byte array of the Attachment
+
+ The active API Key.
+ The active session ID.
+ The requested Ticket Number, must be under the requested account
+ The comment Id that belongs to the requested Ticket
+ The Attachment Id under a comment of the ticket
+ Binary of the file
+
+
+
diff --git a/src/myadmin-sdk/api/codebase/api.js b/src/myadmin-sdk/api/codebase/api.js
new file mode 100644
index 000000000..3ca22642a
--- /dev/null
+++ b/src/myadmin-sdk/api/codebase/api.js
@@ -0,0 +1,622 @@
+/**
+ * @version 2014-07-21
+ * @description The Geotab JS API library.
+ * Used to login and make any API calls to a Geotab server.
+ *
+ * Automatically prompts the user to login if the password is changed or if the
+ * database is moved to another server.
+ *
+ * If credentials are required (for example, the first time you've visited the page, the
+ * database has moved or the user's password has changed, etc.), the "getCredentialsCallback" is executed
+ * with a callback function that can be used on your end to pass credentials into the system. When
+ * you call this function, any pending calls will also be completed automatically.
+
+ * @example
+ * var api = GeotabApi(function(authenticateCallback) {
+ * // We need credentials; we either never had them, or lost them (the server was moved, password
+ * // changed, etc.)
+ *
+ * someLoginDialog.style.display = "block"; // Show a login dialog
+ * someLoginButton.addEventListener("click", function () {
+ * // Call to authenticate
+ * authenticateCallback(serverField.value, databaseField.value, emailField.value, passwordField.value, function(errorString) {
+ * alert(errorString);
+ * });
+ * });
+ * })
+ * @function
+ * @param {Function} getCredentialsCallback This function is called when this class can't login or is
+ * fetching credentials for the first time
+ * @param {Object} [newOptions] Can be used to override default values in the "options" variable
+ * @param {Object} [customCredentialStore] Override the default localStorage-based credential storage
+ with a custom storage implementation
+ */
+var GeotabApi = function (getCredentialsCallback, newOptions, customCredentialStore) {
+ "use strict";
+ var
+ JSONP_REQUESTS_PROPERTY_STR = "geotabJSONP",
+ credentials,
+ server,
+ pendingCalls = [],
+ options = {
+ // Use localStorage to store credentials automatically
+ rememberMe: true,
+ // Show debugging information (in Chrome dev tools, Firebug, etc.)
+ debug: false,
+ // Use JSONP for all calls (for using the API without running a server)
+ jsonp: false,
+ // How long to wait for a response from the server (in seconds); 0 (or null) means no timeout.
+ timeout: 0
+ },
+ credentialsStore,
+ /**
+ * Logs some debug information to the browser console, if options.debug is true
+ * @private
+ */
+ debugLog = function () {
+ if (options.debug) {
+ var logs = [new Date()];
+ logs.push.apply(logs, arguments);
+ console.log.apply(console, logs);
+ }
+ },
+ /**
+ * Normalizes and handles errors
+ * @private
+ * @param {Object} [error] The error object
+ * @callback {failureCallback} [errorCallback] The function to call once the error has been normalize.
+ * It passes back a string for a known error, and the raw error
+ * object if some custom handling is required.
+ */
+ handleError = function (error, errorCallback, apiCall) {
+ var errorString;
+ if (error && error.name && error.message) {
+ if (error.message === "DbUnavailable") {
+ error.message = "Database is not available.";
+ }
+ errorString = error.message;
+ } else if (error.target || (error instanceof XMLHttpRequest && error.status === 0)) {
+ errorString = "Couldn't connect to the server. Please check your network connection, server name and try again.";
+ }
+ if (options.debug) {
+ console.error(errorString, error);
+ }
+ if (error && apiCall) {
+ if (typeof(apiCall) === "string") {
+ try {
+ apiCall = JSON.parse(apiCall);
+ } catch(e) {}
+ }
+ error.apiCall = clearPersonalInformation(apiCall);
+ }
+ if (errorCallback) {
+ errorCallback(errorString || "Error", error);
+ }
+ },
+ /**
+ * Gets the method call URL
+ * @private
+ * @param {String} [method] The method to call on the server
+ * @return {String} The method call URL string
+ */
+ getCallUrl = function (method) {
+ var thisServer = server.replace(/\S*:\/\//, "").replace(/\/$/, "");
+ return "https://" + thisServer + "/apiv1" + (method ? "/" + method : "");
+ },
+ /**
+ * Cleans up the call with the given unique ID
+ * @private
+ * @param {String} uid The unique ID of the response callback
+ */
+ cleanupCall = function (uid) {
+ // Remove this function once we're done with it
+ var script = document.getElementById(uid);
+ if (script) {
+ script.parentNode.removeChild(script);
+ // Manually garbage-collect the script
+ for (var prop in script) {
+ if (script.hasOwnProperty(prop)) {
+ delete script[prop];
+ }
+ }
+ }
+ delete window[JSONP_REQUESTS_PROPERTY_STR][uid];
+ },
+ /**
+ * Construct a JSONP request for a Geotab API call
+ * @private
+ * @param {String} method The name of the API method
+ * @param {Object} params The method parameters
+ * @param {successCallback} callbackSuccess The function that is called if the method call was successful
+ * @param {failureCallback} [callbackError] The function that is called if the method call failed
+ * @return {Object} An object with operations for the call. Supported operation(s): abort()
+ */
+ callJSONP = function (method, params, callbackSuccess, callbackError) {
+ var uid = "json" + (Math.random() * 100).toString().replace(/\./g, ""),
+ buildParamString = function () {
+ params = params || {};
+ var query = [];
+ for (var key in params) {
+ if (params.hasOwnProperty(key)) {
+ query.push.apply(query, ["&", encodeURIComponent(key), "=", encodeURIComponent(JSON.stringify(params[key]))]);
+ }
+ }
+ return query.join("");
+ },
+ timeoutTimer;
+
+ window[JSONP_REQUESTS_PROPERTY_STR][uid] = function JSONPResponse(data) {
+ // Clear timeout timer first
+ if (timeoutTimer) {
+ clearTimeout(timeoutTimer);
+ timeoutTimer = null;
+ }
+
+ // Try to handle the response from the server
+ try {
+ if (data && data.error) {
+ debugLog(method, "ERROR", data.error);
+ handleError(data.error, callbackError, {method: method, params: params});
+ }
+ else {
+ var result = data.result;
+ debugLog(method, "SUCCESS", { result: result });
+ if (callbackSuccess) {
+ callbackSuccess(result);
+ }
+ }
+ }
+ finally {
+ cleanupCall(uid);
+ }
+ };
+ document.getElementsByTagName("body")[0].appendChild((function () {
+ var s = document.createElement("script");
+ s.type = "text/javascript";
+ s.id = uid;
+ s.async = "async";
+ s.src = getCallUrl(method) + "?JSONP=" + JSONP_REQUESTS_PROPERTY_STR + "." + uid + buildParamString();
+ s.onerror = function JSONPError(error) {
+ try {
+ debugLog("CallJSONP", method, "ERROR", error);
+ handleError(error, callbackError, {method: method, params: params});
+ }
+ finally {
+ cleanupCall(uid);
+ }
+ };
+ return s;
+ })());
+
+ if (timeoutTimer) {
+ clearTimeout(timeoutTimer);
+ }
+ if (options.timeout && method !== "Authenticate") {
+ timeoutTimer = setTimeout(function () {
+ if (window[JSONP_REQUESTS_PROPERTY_STR].hasOwnProperty(uid)) {
+ window[JSONP_REQUESTS_PROPERTY_STR][uid]({
+ error: {
+ name: "JSONPTimeout",
+ message: "Could not complete the JSONP request in a timely manner (" + options.timeout + "s)",
+ target: document.getElementById(uid)
+ }
+ });
+ window[JSONP_REQUESTS_PROPERTY_STR][uid] = function () {
+ cleanupCall(uid);
+ };
+ }
+ }, options.timeout * 1000);
+ }
+ return {
+ abort: function () {
+ cleanupCall(uid);
+ if (errorCallback) {
+ errorCallback("Cancelled", {});
+ }
+ }
+ }
+ },
+
+ /**
+ * Goes throw params and remove all sensitive information: user session, password etc
+ * @param {Object} params The API call parameters
+ * @return {Object} Parameters object with remoted/replaced personal info.
+ */
+ clearPersonalInformation = function(params) {
+ if (params) {
+ Object.keys(params).forEach(function(key) {
+ if (key === "credentials") {
+ delete params[key];
+ } else {
+ if (key.toLowerCase().indexOf("password") > -1 && typeof(params[key]) === "string") {
+ params[key] = params[key].replace(/./g, "*");
+ }
+ if (typeof(params[key]) === "object") {
+ clearPersonalInformation(params[key]);
+ }
+ }
+ });
+ }
+ return params;
+ },
+ /**
+ * Construct an XMLHttpRequest POST request for a Geotab API call
+ * @private
+ * @param {String} method The name of the API method
+ * @param {Object} params The method parameters
+ * @param {successCallback} callbackSuccess The function that is called if the method call was successful
+ * @param {failureCallback} [callbackError] The function that is called if the method call failed
+ * @return {Object} An object with operations for the call. Supported operation(s): abort()
+ */
+ callXHR = function (method, params, callbackSuccess, callbackError) {
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", getCallUrl(), true);
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ xhr.addEventListener("abort", function (e) {
+ if (callbackError) {
+ callbackError("Cancelled", e);
+ }
+ });
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState === 4) {
+ if (xhr.status === 200) {
+ var data,
+ error,
+ result;
+ try {
+ data = JSON.parse(xhr.responseText);
+ if (data && data.error) {
+ error = data.error;
+ debugLog(method, "ERROR", error);
+ handleError(error, callbackError, rpcString || null);
+ } else {
+ result = data.result;
+ debugLog(method, "SUCCESS", { result: result });
+ callbackSuccess(result);
+ }
+ }
+ catch (e) {
+ handleError(e, callbackError, rpcString || null);
+ }
+ } else {
+ debugLog(method, "ERROR", xhr);
+ handleError(xhr, callbackError, rpcString || null);
+ }
+ }
+ };
+ var rpcString;
+ try {
+ rpcString = JSON.stringify({
+ method: method || "",
+ params: params
+ });
+ }
+ catch (e) {
+ handleError(e, callbackError);
+ return;
+ }
+ if (options.timeout) {
+ xhr.timeout = options.timeout * 1000;
+ }
+ xhr.send("JSON-RPC=" + encodeURIComponent(rpcString));
+ return {
+ abort: function () {
+ xhr.abort();
+ }
+ }
+ },
+ /**
+ * Construct a request for a Geotab API call
+ * @private
+ * @param {String} method The name of the API method
+ * @param {Object} params The method parameters
+ * @param {successCallback} callbackSuccess The function that is called if the method call was successful
+ * @param {failureCallback} [callbackError] The function that is called if the method call failed
+ * @return {Object} An object with operations for the call. Supported operation(s): abort()
+ */
+ callBase = function (method, params, callbackSuccess, callbackError) {
+ if (options.jsonp) {
+ return callJSONP(method, params, callbackSuccess, callbackError);
+ }
+ return callXHR(method, params, callbackSuccess, callbackError);
+ },
+ /**
+ * Authenticates a Geotab user
+ * @private
+ * @param {String} newServer The federation server name string
+ * @param {String} database The database name
+ * @param {String} username The username/email to authenticate with
+ * @param {String} password The password to authenticate with
+ * @param {successCallback} callbackSuccess The function that is called on the successful authentication
+ * @param {failureCallback} [callbackError] The function that is called when there is an
+ * authentication failure with the error string and the
+ * error objects as parameters
+ * @return {Object} An object with operations for the call. Supported operation(s): abort()
+ */
+ authenticateWithServer = function (newServer, database, username, password, callbackSuccess, callbackError) {
+ server = newServer;
+ // Authenticate the user
+ return callBase("Authenticate", {
+ database: database,
+ userName: username,
+ password: password
+ }, function (data) {
+ if (data.path && data.path !== "ThisServer") {
+ server = "https://" + data.path + "/";
+ }
+ credentials = data.credentials;
+ if (options.rememberMe) {
+ credentialsStore.set(credentials, server);
+ }
+ if (callbackSuccess) {
+ callbackSuccess(credentials);
+ }
+ }, callbackError);
+ },
+ /**
+ * Populates the authenticate callback with a function
+ * @private
+ * @param {successCallback} [callbackSuccess] Called when we have successfully authenticated
+ */
+ populateAuthenticationCallback = function (callbackSuccess) {
+ getCredentialsCallback(function (newServer, database, username, password, success, error) {
+ return authenticateWithServer(newServer, database, username, password, function (credentials) {
+ success && success();
+ if (callbackSuccess) {
+ callbackSuccess(credentials);
+ }
+ // Try again
+ pendingCalls.forEach(function (p) {
+ call.apply(this, p);
+ });
+ pendingCalls = [];
+ }, error);
+ });
+ },
+
+ calls = (function() {
+ var calls = [],
+ add = function(call) {
+ calls.push(call);
+ },
+ remove = function(call) {
+ calls = calls.filter(function(candidate) {
+ return candidate !== call;
+ });
+ },
+ abort = function() {
+ calls.forEach(function(call) {
+ call && call.abort && call.abort();
+ });
+ calls = [];
+ };
+
+ return {
+ add: add,
+ remove: remove,
+ abort: abort
+ }
+ })(),
+ /**
+ * Calls a Geotab method. Handles cases where the credentials have expired or are invalid.
+ * @public
+ * @param {String} method The name of the API method
+ * @param {Object} params The method parameters object.
+ * @param {successCallback} successCallback The function that is called if the method call was successful
+ * @param {failureCallback} [errorCallback] The function that is called if the method call failed
+ * @return {Object} An object with operations for the call. Supported operation(s): abort()
+ */
+ call = function (method, params, successCallback, errorCallback) {
+ var
+ needsLoginAndCall = function () {
+ pendingCalls.push([method, params, successCallback, errorCallback]);
+ var storedCredentials = credentialsStore.get();
+ if (storedCredentials && options.rememberMe) {
+ credentials = storedCredentials.credentials;
+ server = storedCredentials.server;
+ // Try again
+ pendingCalls.forEach(function (p) {
+ call.apply(this, p);
+ });
+ pendingCalls = [];
+ }
+ else {
+ populateAuthenticationCallback();
+ }
+ },
+ apiCall;
+
+ successCallback = successCallback || options.defaultSuccessCallback;
+ errorCallback = errorCallback || options.defaultErrorCallback;
+ if (!credentials) {
+ needsLoginAndCall();
+ return { abort: function () {} };
+ }
+ params.credentials = credentials;
+ apiCall = callBase(method, params, successCallback, function (errorString, errorObject) {
+ var errors = errorObject.errors;
+ calls.remove(apiCall);
+ apiCall = null;
+
+ if (errors && errors[0] && errors[0].name === "InvalidUserException" && method !== "Authenticate") {
+ // We do have a credentials token, but it's no longer valid
+ // Let's clear it and save the credentials
+ credentialsStore.clear(true);
+ needsLoginAndCall();
+ }
+ else {
+ if (errorCallback) {
+ errorCallback(errorString, errorObject);
+ }
+ }
+ });
+ calls.add(apiCall);
+ return apiCall;
+ },
+ /**
+ * Calls multiple Geotab methods at the same time. Returns an array of results corresponding to the order the calls are passed in
+ * @public
+ * @param {Array} calls The calls array. For each entity in this array, we expect a 1 or 2 item array: the first
+ * item is the method name, and (optionally) the second is an object of the method parameters
+ * eg. [
+ * ["GetVersion"],
+ * ["Get", { typeName: "Device", search: { serialNumber: "GTA1234556678" } }],
+ * ["Add", { typeName: "Device", entity: { name: "New Device", serialNumber: "GTA0000000000" }]
+ * ]
+ * @param {successCallback} callbackSuccess The function that is called if the method calls were all successful
+ * @param {failureCallback} [callbackError] The function that is called if any method call failed
+ * @return {Object} An object with operations for the call. Supported operation(s): abort()
+ */
+ multiCall = function (calls, callbackSuccess, callbackError) {
+ var formattedCalls = calls.map(function (call) {
+ var params = call[1];
+ return {
+ method: call[0],
+ params: params
+ };
+ });
+ return call("ExecuteMultiCall", {
+ calls: formattedCalls
+ }, callbackSuccess, callbackError);
+ },
+ /**
+ * Retrieves a session. Useful for single sign-on or other cases where you require the credentials
+ * @param {successCallback} callbackSuccess The function that is called if the retrieval of sessionId was successful
+ * @param {Boolean} [newSession] If true, always retrieve a new session from the server. Otherwise, return the current session (if active) or
+ * retrieve a new one from the server if there are no active sessions
+ */
+ getSession = function (callbackSuccess, newSession) {
+ var storedCredentials = credentialsStore.get();
+ if (!newSession && storedCredentials && options.rememberMe) {
+ if (callbackSuccess) {
+ callbackSuccess(storedCredentials.credentials, storedCredentials.server);
+ }
+ return;
+ }
+ populateAuthenticationCallback(function () {
+ if (callbackSuccess) {
+ // At this point, "credentials" and "server" have been set within populateAuthenticationCallback()
+ callbackSuccess(credentials, server);
+ }
+ });
+ },
+ /**
+ * Clears credentials and the credential store.
+ * @public
+ */
+ forget = function (successCallback) {
+ credentials = null;
+ credentialsStore.clear();
+ populateAuthenticationCallback(successCallback || null);
+ },
+ setDefaultHandlers = function(successHandler, errorHandler) {
+ options.defaultSuccessCallback = successHandler;
+ options.defaultErrorCallback = errorHandler;
+ };
+
+ // Overrides default options with passed in ones, if there are any
+ if (newOptions) {
+ for (var prop in newOptions) {
+ if (newOptions.hasOwnProperty(prop)) {
+ options[prop] = newOptions[prop];
+ }
+ }
+ }
+
+ // Creates a property for managing open requests
+ window[JSONP_REQUESTS_PROPERTY_STR] = {};
+
+ /**
+ * The default credentials store. Uses localStorage to save and retrieve
+ * credentials to save a user's session.
+ */
+ var defaultCredentialsStore = {
+ CREDENTIALS_KEY: "geotabAPI_credentials",
+ SERVER_KEY: "geotabAPI_server",
+ POSSIBLE_CREDENTIALS_KEY: "sTokens_geotabdemo",
+ /**
+ * Gets the credentials from localStorage
+ * @returns {*} An object with two properties: "server", a server name
+ * string, and "credentials", a credentials object
+ */
+ get: function () {
+ var storedCredentials = localStorage.getItem(this.CREDENTIALS_KEY),
+ storedServer = localStorage.getItem(this.SERVER_KEY),
+ thisCredentials = false;
+
+ if (!storedCredentials || !storedServer) {
+ storedCredentials = localStorage.getItem(this.POSSIBLE_CREDENTIALS_KEY);
+ if (storedCredentials) {
+ storedServer = window.location.host;
+ }
+ }
+
+ if (storedCredentials && storedServer) {
+ try {
+ thisCredentials = {
+ credentials: JSON.parse(storedCredentials),
+ server: storedServer
+ };
+ }
+ catch (e) {
+ // Malformed JSON
+ return false;
+ }
+ }
+ return thisCredentials;
+ },
+ /**
+ * Saves the credentials into localStorage
+ * @param {Object} credentials The credentials object
+ * @param {String} server The server string
+ */
+ set: function (credentials, server) {
+ localStorage.setItem(this.CREDENTIALS_KEY, JSON.stringify(credentials));
+ localStorage.setItem(this.SERVER_KEY, server);
+ },
+
+ /**
+ * Clears the credentials from localStorage
+ */
+ clear: function () {
+ localStorage.removeItem(this.CREDENTIALS_KEY);
+ localStorage.removeItem(this.SERVER_KEY);
+ localStorage.removeItem(this.POSSIBLE_CREDENTIALS_KEY);
+ }
+ };
+
+ // If applicable, overrides default credentials storage implementation with a
+ // custom one that was passed into the constructor
+ credentialsStore = customCredentialStore || defaultCredentialsStore;
+
+ // Public methods
+ return {
+ call: call,
+ multiCall: multiCall,
+ abort: calls.abort,
+ forget: forget,
+ getSession: getSession,
+ setDefaultHandlers: setDefaultHandlers
+ };
+};
+
+if (typeof define !== 'undefined' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(function () {
+ 'use strict';
+ return GeotabApi;
+ });
+}
+
+// JSDoc Addenda
+/**
+ * This callback is called when a web request is successful
+ * @callback successCallback
+ * @param {*} [response] The response array or object
+ */
+/**
+ * This callback is called when a web request is successful
+ * @callback failureCallback
+ * @param {String} errorString The human-readable error string
+ * @param {Object} errorObject The error object (could be a JS Error object, JS Event object, XMLHttpRequest object, or MyGeotab error object)
+ */
\ No newline at end of file
diff --git a/src/myadmin-sdk/api/codebase/console.css b/src/myadmin-sdk/api/codebase/console.css
new file mode 100644
index 000000000..18122169f
--- /dev/null
+++ b/src/myadmin-sdk/api/codebase/console.css
@@ -0,0 +1,50 @@
+.console {
+ font-family: Consolas, Lucida Console, monospace;
+ font-size: 13px;
+}
+.consoleRecord {
+ margin: 4px;
+ box-sizing: border-box;
+ padding: 4px 8px;
+ border-bottom: 1px solid #efefef;
+}
+.consoleItem {
+ display: inline-block;
+ vertical-align: top;
+ margin-right: 10px;
+ max-width: 100%;
+ word-wrap: break-word;
+}
+.consoleError {
+ color: #ff0000;
+}
+.data-object-line {
+ display: block;
+}
+.data-object-children {
+ padding-left: 20px;
+ display: block;
+}
+.data-object-children-hidden {
+ display: none;
+}
+.data-object-title {
+ cursor: default;
+}
+.data-object-marker {
+ display: inline-block;
+ width: 10px;
+}
+.data-object-key {
+ color: #952e8e;
+}
+.data-object-inactive-key {
+ color: #cfa2d3;
+}
+.data-object-string-value {
+ color: #c4211d;
+}
+.data-number-value,
+.data-boolean-value {
+ color: #523dd9;
+}
\ No newline at end of file
diff --git a/src/myadmin-sdk/api/codebase/console.js b/src/myadmin-sdk/api/codebase/console.js
new file mode 100644
index 000000000..6596b4f05
--- /dev/null
+++ b/src/myadmin-sdk/api/codebase/console.js
@@ -0,0 +1,274 @@
+var ConsoleManager = (function() {
+ var consolePreviewer = function(data, container) {
+ var renderObject = function(key, data, parent, isChildProperty, isInactive) {
+ var type = typeof(data);
+ if (type === "object") {
+ if (Array.isArray(data)) {
+ type = "array";
+ }
+ }
+ if (data === null) {
+ data = "null";
+ type = "string";
+ }
+ if (data === undefined) {
+ data = "undefined";
+ type = "string";
+ }
+ if (renderers[type]) {
+ renderers[type](key, data, parent, isChildProperty, isInactive);
+ }
+ },
+ createElement = function(tag, className, innerHTML) {
+ var element = document.createElement(tag);
+ element.className = className;
+ element.innerHTML = htmlEscape(innerHTML);
+ return element;
+ },
+ renderers = {
+ "string": function(key, data, parent, isChildProperty, isInactive) {
+ var marker = key ? createElement("span", "data-object-marker", "") : null,
+ keyClassName = isInactive ? "data-object-inactive-key" : "data-object-key",
+ keyElement = key ? createElement("span", keyClassName, key + ": ") : null,
+ valueClassName = key ? "data-object-string-value" : "data-string-value",
+ dataWithQuotes = isChildProperty ? "\"" + data + "\"" : data,
+ value = createElement("span", valueClassName, dataWithQuotes);
+
+ marker && parent.appendChild(marker);
+ keyElement && parent.appendChild(keyElement);
+ parent.appendChild(value);
+ },
+ "function": function(key, data, parent, isChildProperty, isInactive) {
+ var marker = key ? createElement("span", "data-object-marker", "") : null,
+ keyClassName = isInactive ? "data-object-inactive-key" : "data-object-key",
+ keyElement = key ? createElement("span", keyClassName, key + ": ") : null,
+ valueClassName = "data-function-value",
+ dataWithQuotes = "function() { ... }",
+ value = createElement("span", valueClassName, dataWithQuotes);
+
+ marker && parent.appendChild(marker);
+ keyElement && parent.appendChild(keyElement);
+ parent.appendChild(value);
+ },
+ "boolean": function(key, data, parent, isChildProperty, isInactive) {
+ var marker = key ? createElement("span", "data-object-marker", "") : null,
+ keyClassName = isInactive ? "data-object-inactive-key" : "data-object-key",
+ keyElement = key ? createElement("span", keyClassName, key + ": ") : null,
+ value = createElement("span", "data-boolean-value", data ? "true" : "false");
+
+ marker && parent.appendChild(marker);
+ keyElement && parent.appendChild(keyElement);
+ parent.appendChild(value);
+ },
+ "number": function(key, data, parent, isChildProperty, isInactive) {
+ var marker = key ? createElement("span", "data-object-marker", "") : null,
+ keyClassName = isInactive ? "data-object-inactive-key" : "data-object-key",
+ keyElement = key ? createElement("span", keyClassName, key + ": ") : null,
+ value = createElement("span", "data-number-value", "" + data);
+
+ marker && parent.appendChild(marker);
+ keyElement && parent.appendChild(keyElement);
+ parent.appendChild(value);
+ },
+ "object": function(key, data, parent, isChildProperty) {
+ var isEmpty = (function(data) {
+ var i;
+ for (i in data) {
+ if (data.hasOwnProperty(i)) {
+ return false;
+ }
+ }
+ return true;
+ })(data),
+ title = createElement("span", "data-object-title", ""),
+ marker = createElement("span", "data-object-marker", "+"),
+ keyElement = isChildProperty ? createElement("span", "data-object-key", key + ": ") : null,
+ value = createElement("span", "data-object-value", "Object"),
+ preview = !isChildProperty ? createElement("span", "data-object-preview", " { " + (!isEmpty ? "... " : "") + "}") : null,
+ children = createElement("span", "data-object-children-hidden", "");
+
+ if (isEmpty) {
+ if (isChildProperty) {
+ title.appendChild(marker);
+ title.appendChild(keyElement);
+ }
+ if (preview !== null) {
+ title.appendChild(preview);
+ } else {
+ title.appendChild(value);
+ }
+ parent.appendChild(title);
+ parent.appendChild(children);
+ } else if (!isChildProperty) {
+ title.appendChild(marker);
+ title.appendChild(value);
+ title.appendChild(preview);
+ parent.appendChild(title);
+ parent.appendChild(children);
+ } else {
+ title.appendChild(marker);
+ title.appendChild(keyElement);
+ title.appendChild(value);
+ parent.appendChild(title);
+ parent.appendChild(children);
+ }
+
+ title.addEventListener("click", function() {
+ var className = children.className,
+ isRendered = children.innerHTML.length > 0,
+ isOpened = className.indexOf("data-object-children-hidden") === -1;
+
+ if (!isRendered) {
+ natSort(Object.keys(data)).forEach(function (key) {
+ var line = createElement("span", "data-object-line", "");
+ renderObject(key, data[key], line, true);
+ children.appendChild(line);
+ });
+ }
+ children.className = isOpened ? "data-object-children-hidden" : "data-object-children";
+ marker.innerHTML = isOpened ? "+" : "-";
+ }, false);
+ },
+ "array": function(key, data, parent, isChildProperty) {
+ var title = createElement("span", "data-object-title", ""),
+ marker = createElement("span", "data-object-marker", "+"),
+ keyElement = isChildProperty ? createElement("span", "data-object-key", key + ": ") : null,
+ value = createElement("span", "data-object-value", "Array[" + data.length + "]"),
+ preview = !isChildProperty ? createElement("span", "data-object-preview", " [ ... ]") : null,
+ children = createElement("span", "data-object-children-hidden", "");
+
+ if (!isChildProperty) {
+ title.appendChild(marker);
+ title.appendChild(value);
+ title.appendChild(preview);
+ parent.appendChild(title);
+ parent.appendChild(children);
+ } else {
+ title.appendChild(marker);
+ title.appendChild(keyElement);
+ title.appendChild(value);
+ parent.appendChild(title);
+ parent.appendChild(children);
+ }
+
+ title.addEventListener("click", function() {
+ var className = children.className,
+ isRendered = children.innerHTML.length > 0,
+ isOpened = className.indexOf("data-object-children-hidden") === -1,
+ line,
+ renderChild = function(key, value, isInactive) {
+ var line = createElement("span", "data-object-line", "");
+ renderObject(key, value, line, true, isInactive);
+ children.appendChild(line);
+ };
+
+ if (!isRendered) {
+ natSort(Object.keys(data)).concat().forEach(function (key) {
+ renderChild(key, data[key]);
+ });
+ renderChild("length", data.length, true);
+ }
+ children.className = isOpened ? "data-object-children-hidden" : "data-object-children";
+ marker.innerHTML = isOpened ? "+" : "-";
+ }, false);
+ }
+ },
+ clear = function() {
+ data = null;
+ container = null;
+ };
+
+ renderObject(null, data, container);
+ return {
+ clear: clear
+ };
+ },
+
+ natSort = function(array) {
+ return array.sort(function(a, b) {
+ var aa = parseInt(a),
+ bb = parseInt(b),
+ aIsNum = !isNaN(aa),
+ bIsNum = !isNaN(bb);
+
+ a = aIsNum ? aa : a;
+ b = bIsNum ? bb : b;
+
+ if (aIsNum && !bIsNum) {
+ return -1;
+ }
+ if (!aIsNum && bIsNum) {
+ return 1;
+ }
+ return a > b ? 1 : -1;
+ });
+ },
+
+ htmlEscape = function (str) {
+ return String(str || "")
+ .replace(/&/g, '&')
+ .replace(/"/g, '"')
+ .replace(/'/g, ''')
+ .replace(//g, '>');
+ };
+
+ return function(containerId) {
+ var container = document.getElementById(containerId),
+ render = function() {},
+ getConsoleRecord = function() {
+ var record = document.createElement("div");
+ record.className = "consoleRecord";
+ return record;
+ },
+ scrollToTheEnd = function() {
+ container.scrollTop = container.scrollHeight;
+ },
+ views = [],
+ consoleLog = function() {
+ var record = getConsoleRecord();
+ [].forEach.call(arguments, function(argument) {
+ var item = document.createElement("span");
+ item.className = "consoleItem";
+ record.appendChild(item);
+ views.push(consolePreviewer(argument, item));
+ });
+ container.appendChild(record);
+ console.log.apply(console, arguments);
+ scrollToTheEnd();
+ },
+ consoleError = function() {
+ var record = getConsoleRecord();
+ [].forEach.call(arguments, function(argument) {
+ var item = document.createElement("span");
+ item.className = "consoleItem consoleError";
+ if (typeof(argument) === "object" && argument.message) {
+ argument = argument.message + (argument.url ? " (" + argument.url + (argument.position ? ":" + argument.position : "") + ")" : "");
+ }
+ item.innerHTML = htmlEscape(argument);
+ record.appendChild(item);
+ });
+ container.appendChild(record);
+ console.error.apply(console, arguments);
+ scrollToTheEnd();
+ },
+ process = function(value) {
+ return value;
+ },
+ clear = function() {
+ views.forEach(function(view) {
+ view.clear();
+ });
+ views = [];
+ container.innerHTML = "";
+ };
+
+ return {
+ render: render,
+ process: process,
+ log: consoleLog,
+ error: consoleError,
+ clear: clear
+ };
+ };
+})();
\ No newline at end of file
diff --git a/src/myadmin-sdk/api/codebase/githubApi.js b/src/myadmin-sdk/api/codebase/githubApi.js
new file mode 100644
index 000000000..286deb15b
--- /dev/null
+++ b/src/myadmin-sdk/api/codebase/githubApi.js
@@ -0,0 +1,188 @@
+var GithubApi = function(userName, repoName) {
+ var github = new Github({}),
+ repo = github.getRepo(userName, repoName),
+
+ getSamples = function(successCallback, errorCallback) {
+ window.setTimeout(function() {
+ var samples = document.querySelectorAll(".sample-sample");
+ successCallback([].map.call(samples, function(sample) {
+ var sampleId = sample.id,
+ sampleName = sampleId;
+
+ sampleName = sampleName.replace(/\-/g, " ");
+ sampleName = sampleName[0].toUpperCase() + sampleName.substr(1);
+ return {
+ id: sampleId,
+ name: sampleName
+ };
+ }));
+ }, 500);
+ /*repo.contents("master", ".", function(err, topFiles) {
+ if (err) {
+ errorCallback(err);
+ } else {
+ successCallback(topFiles.filter(function(file) {
+ return file.type === "dir";
+ }).map(function (file) {
+ return file.name;
+ }));
+ }
+ });*/
+ },
+ getSample = function(sampleName, successCallback, errorCallback) {
+ window.setTimeout(function() {
+ var sampleContainer = document.getElementById(sampleName),
+ options, temp;
+
+ sampleContainer = sampleContainer || document.getElementById("device-location");
+ options = sampleContainer.querySelector(".sample-options").innerHTML;
+ try {
+ eval("temp = " + options);
+ options = temp;
+ } catch (e) {
+ options = {};
+ }
+ successCallback({
+ js: sampleContainer.querySelector(".sample-js").innerHTML.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"),
+ css: sampleContainer.querySelector(".sample-css").innerHTML.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"),
+ html: sampleContainer.querySelector(".sample-html").innerHTML.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"),
+ options: options
+ });
+ }, 500);
+ };
+
+ return {
+ getSamples: getSamples,
+ getSample: getSample
+ };
+};
+
+
+var SamplesApi = function() {
+ var samples = [
+ "new",
+ "api-call",
+ "device-location",
+ "current-location-and-driving-status",
+ "move-vehicle-to-group-and-enable-speed-buzzing",
+ "get-odometer-and-vin-for-vehicles-in-a-group",
+ "add-driver",
+ "replace-existing-vehicle-with-new-go-device",
+ "find-current-live-address-of-driver",
+ "add-driver-with-nothing-clearance",
+ "manipulate-user",
+ "get-zone-stop-exceptions",
+ "get-device-speeds-and-road-speeds",
+ "get-count-of-stops-at-client-zone",
+ "create-10-groups-and-add-devices",
+ "dvir-unrepaired-defects-last-month",
+ "hos-availability-search",
+ "find-month-with-the-longest-distance-driven",
+ "get-all-unbroken-exceptions-for-the-last-week",
+ "filter-out-non-valid-position-log-records",
+ "calculate-fuel-usage",
+ "import-usa-states-as-zones",
+ "get-fuel-tax-details",
+ "generate-addin-guid"
+ ],
+ createXHR = ((typeof (window) !== 'undefined' && window.XMLHttpRequest) ?
+ function () {
+ return new XMLHttpRequest();
+ } :
+ function () {
+ return new ActiveXObject('Microsoft.XMLHTTP');
+ }
+ ),
+ load = function (url, successCallback, errorCallback) {
+ var xhr = createXHR(),
+ isGet = true;
+
+ xhr.open("get", url, true);
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ if (xhr.status === 200){
+ successCallback(xhr.responseText);
+ } else {
+ errorCallback(url, xhr);
+ }
+ xhr.onreadystatechange = null
+ }
+ };
+ xhr.timeout = 30000;
+ xhr.ontimeout = function () {
+ errorCallback(url, xhr);
+ };
+ xhr.send(!isGet && params ? params : null);
+ return xhr;
+ },
+
+ getSamples = function(successCallback, errorCallback) {
+
+ window.setTimeout(function() {
+ successCallback(samples.map(function(sampleId) {
+ var sampleName = sampleId;
+
+ sampleName = sampleName.replace(/\-/g, " ");
+ sampleName = sampleName[0].toUpperCase() + sampleName.substr(1);
+
+ return {
+ id: sampleId,
+ name: sampleName
+ };
+ }));
+ }, 1);
+ },
+ getSample = function(sampleName, successCallback, errorCallback) {
+ var result = {},
+ isAllLoaded = function() {
+ var options = ["js", "css", "html", "options"],
+ isOptionLoaded = function(option) {
+ return typeof(result[option]) !== "undefined";
+ };
+
+ if (options.every(isOptionLoaded)) {
+ successCallback(result);
+ }
+ },
+ getSuccessCallback = function(language) {
+ return function(content) {
+ if (language === "js") {
+ content = content.replace(/(\r?\n)?\/\*opt nomin\*\/\s*\n\s*self\.geotab \&\& geotab\.declare\(\".+\"\);\s*$/, "");
+ }
+ result[language] = content;
+ isAllLoaded();
+ };
+ },
+ isErrorHandlerCalled = false,
+ errorHandler = function(url) {
+ if (!isErrorHandlerCalled) {
+ isErrorHandlerCalled = true;
+ errorCallback("Can't load sample file: " + url);
+ requests.forEach(function (xhr) {
+ xhr.abort && xhr.abort();
+ });
+ requests = [];
+ }
+ },
+ requests = [];
+
+ requests.push(load("samples/" + sampleName + "/sample.js", getSuccessCallback("js"), errorHandler));
+ requests.push(load("samples/" + sampleName + "/sample.css", getSuccessCallback("css"), errorHandler));
+ requests.push(load("samples/" + sampleName + "/sample.html", getSuccessCallback("html"), errorHandler));
+ requests.push(load("samples/" + sampleName + "/config.json", function(options) {
+ try {
+ options = JSON.parse(options);
+ } catch (e) {
+ options = {};
+ }
+ result.options = options;
+ isAllLoaded();
+ }, errorHandler));
+ };
+
+ return {
+ getSamples: getSamples,
+ getSample: getSample
+ };
+};
diff --git a/src/myadmin-sdk/api/codebase/iframe.html b/src/myadmin-sdk/api/codebase/iframe.html
new file mode 100644
index 000000000..1b2d3f3fc
--- /dev/null
+++ b/src/myadmin-sdk/api/codebase/iframe.html
@@ -0,0 +1,204 @@
+
+
+