OEM WebAPI 1.3
OEM WebAPI 1.3
1
1 REVISION HISTORY
Date Version Change
2020-04-13 1.0 First Recorded Version
2020-05-14 1.1 Batch string
2020-09-17 1.2 Driver List get and set
2021-02-09 1.3 New calls for setting individual parameters
Added information on how to check for async messages being actioned
2 INTRODUCTION
The OEM WebAPI provides a wealth of features which enable some control of device settings etc
from a 3rd party platform.
1. OEM actions such as setting parameters, parameter templates, the batch string, and
connectors
The WebAPI brings some useful functionality - as the device can be controlled programmatically
based upon other events happening. Examples include:
Users will need to authenticate with basic authentication and their standard OEM username and
password.
Contact DM if you require a specific user account to be set up for API use.
3 FURTHER RESOURCES
This document covers the specific API calls used. For more information about device behaviour,
parameter templates, connectors, the OEM server etc, see support.digitalmatter.com.
Some relevant links are provided where appropriate in this document.
2
4 CONTENTS
1 REVISION HISTORY .......................................................................................................................... 2
2 INTRODUCTION ............................................................................................................................... 2
3 FURTHER RESOURCES ..................................................................................................................... 2
4 CONTENTS ....................................................................................................................................... 3
5 DEVICE IDs ....................................................................................................................................... 4
6 OEM ACTIONS ................................................................................................................................. 5
6.1 Get a list of Parameter templates and set them. ................................................................... 5
6.1.1 Get Templates (GET) ....................................................................................................... 5
6.1.2 Set Single (GET): .............................................................................................................. 5
6.1.3 Set Parameter Template on Multiple devices (POST) ..................................................... 6
6.2 Setting Individual Parameters via API Call .............................................................................. 6
6.2.1 GetProductDefaultAdminParameters (GET) ................................................................... 6
6.3 Change Connectors ............................................................................................................... 12
6.4 Set Enabled ........................................................................................................................... 12
6.5 Set Custom Fields (for use with connectors) ........................................................................ 12
6.6 Set Batch String ..................................................................................................................... 13
6.7 Set the Driver List .................................................................................................................. 13
6.8 Get the Driver List ................................................................................................................. 14
7 ASYNC MESSAGING TO DEVICES ................................................................................................... 15
7.1 Checking Message Delivery................................................................................................... 15
7.2 0x001 – Resync Device Slots ................................................................................................. 17
7.3 0x002 - Remote Restart ........................................................................................................ 17
7.4 0x003 - Set Operational (recovery) mode............................................................................. 17
7.4.1 Set Operational Mode – Confirming the device has actioned recovery mode............. 19
7.5 0x004 - Set Digital Output ..................................................................................................... 19
7.5.1 Set Output – confirming the device has actioned the change ...................................... 20
7.6 0x0012 - Set Odometer ......................................................................................................... 20
7.7 0x0013 - Set Run Hours ......................................................................................................... 20
7.8 0x0015 - Third Party Data ..................................................................................................... 20
7.9 0x0016 – Geofence Download .............................................................................................. 21
7.10 0x0100 – Immobilise ............................................................................................................. 21
7.10.1 Immobilisation – Determining Immobilisation Status .................................................. 21
7.11 0x0101 - Immobilise With Expiry .......................................................................................... 21
3
5 DEVICE IDs
The main device IDs are below. Some calls require the device ID to be passed.
Remora 33 (0x21)
Dart 34 (0x22)
Oyster v1 Cellular 58 (0x3A)
Remora2 62 (0x3E)
G62 67 (0x43)
Dart2 68 (0x44)
G200 70 (0x46)
Yabby Wifi Cellular 72 (0x48)
Yabby GPS Cellular 73 (0x49)
Falcon Cellular 74 (0x4A)
Bolt 75 (0x4B)
Oyster2 77 (0x4D)
Eagle 78 (0x4E)
G120 79 (0x4F)
Device ID’s can also be found in the “Product” column of the device table in OEM.
For example below shows 79.2 – 79 = the G120, .2 indicates it is the 4G variant.
4
6 OEM ACTIONS
6.1 Get a list of Parameter templates and set them.
Parameter templates can be created from the OEM UI – see here.
It is best to make use of templates where possible, as then we can be sure we are applying the same
parameters across a group of devices. This also has the additional benefit that the applied template
is indicated in the OEM UI – so at a glance we can see which devices have the same parameters. The
same cannot be said when we set parameters individually.
Request Endpoint
Name Method Description
https://api.oemserver.com/v1.0/paramtemplate/get/X GET Get template with ID X
Url Parameters
Name Data Type Required/Optional Description
X number Optional If added to the query, template X will be returned. Otherwise,
all templates accessible by the user will be returned.
Url Parameters
Name Data Type Required/Optional Description
X number required This is the id of the parameter template to be set.
Y Number Required Serial to apply template to.
5
Url Parameters
Name Data Type Required/Optional Description
X Number Required ID of the parameter
template to be set
Z Number Required IMEI of device to
apply template to.
Url Parameters
Name Data Type Required/Optional Description
X Number Required ID of the parameter
template to be set
Url Parameters
Name Data Type Required/Optional Description
X Number Required ID of the parameter
template to be set
{
"Devices":["123456789090","123456789090"]
}
6
Request Endpoint
Name Method Description
v1.0/TrackingDevice/GetProductDefaultAdminParameters/ProductId GET Returns all the default
admin parameters for a
device type in OEM
Url Parameters
Name Data Type Required/Optional Description
ProductId number required This is the id of the product
that exists in OEM to be
queried.
Query Parameter
Name Data Type Required/Optional Description
nocomments string optional If added to the query, the
returned JSON will omit
comments. The JSON with
omitted comments can be
used as a template for the
calls to set templates
Example
https://api.oemserver.com/v1.0/TrackingDevice/GetProductDefaultAdminParameters/62?nocomments
The above example will return the default admin parameters in JSON for the Remora2 (ProductId 62)
device type from OEM as shown below:
{
"Devices": [123456,654321],
"ParamSections": [
{
"Id": 100,
"Params": {
"Upload_Server": "s2.oemserver.com",
"Upload_Port": "9980",
"fEncrypted": "1"
}
},
{
"Id": 200,
"Params": {
"External_Server": "",
"External_Port": "8980",
"bSlotCheckPeriod": "7",
"fSupportsAsync": "0",
"fSendVersionData": "0"
}
},
{
"Id": 300,
"Params": {
"Upload_Server": "",
"File_Path": "/handlers/geofencedownload.ashx"
}
},
{
"Id": 1000,
"Params": {
"APN_String": "internet"
}
},
{
"Id": 2000,
"Params": {
"b4GRAT": "0",
"sPreset": "",
"sCustom": ""
7
}
}
]
}
Request Endpoint
Name Method Description
v1.0/TrackingDevice/GetProductDefaultDeviceParameters/ProductId GET Returns all the default
device parameters for a
device type in OEM
Url Parameter
Name Data Type Required/Optional Description
ProductId number required This is the id of the product
that exists in OEM to be
queried.
Query Parameter
Name Data Type Required/Optional Description
nocomments string optional If added to the query, the
returned JSON will omit
comments. The JSON with
omitted comments can be
used as a template.
Example
https://api.oemserver.com/v1.0/TrackingDevice/GetProductDefaultDeviceParameters/62?nocomments
The above example will return the default device parameters in JSON for the Remora2 (ProductId 62)
device type from OEM.
6.2.1.2 SetAdminParameters (POST)
A POST method added to replace the values of admin parameters set on devices that exists in OEM
with the provided ProductId. All parameters will be overwritten with the ones supplied, including
setting any not supplied back to default.
Request Endpoint
Name Method Description
v1.0/TrackingDevice/SetAdminParameters/ProductId POST Posts data to the OEM
Web API that is used to
replace admin parameters.
Url Parameter
Name Data Type Required/Optional Description
ProductId number required This is the id of the product
that exists in OEM.
Body
Name Data Type Required/Optional Description
Devices string array required This is a list of the device
serial numbers.
8
ParamSections JSON object array optional If this object is empty or is
omitted from the POST, the
admin parameters from the
list of devices will be set to
their default values.
Example
JSON data to be posted to https://api.oemserver.com/v1.0/TrackingDevice/SetAdminParameters/62
{
"Devices": [
"232759"
],
"ParamSections": [
{
"Id": 1000,
"Params": {
"APN_String": "APN_Updated_API"
}
},
{
"Id": 100,
"Params": {
"Upload_Server": "qa.oemserver.com",
"Upload_Port":"9980",
"fEncrypted":"yes"
}
}
]
}
The above example will set the existing admin parameters for the Remora2 device with serial
number 232759 using the provided JSON. Any omitted admin parameters will be set to their
defaults.
6.2.1.3 SetAdminParameters (PUT)
This PUT method updates the values of admin parameters set on the device. This can be used to
update a specific parameter or parameters while leaving the others unchanged.
Request Endpoint
Name Method Description
v1.0/TrackingDevice/SetAdminParameters/ProductId PUT Posts data to the OEM
Web API that is used to
update admin parameters.
Url Parameter
Name Data Type Required/Optional Description
ProductId number required This is the id of the product
that exists in OEM.
9
Body
Name Data Type Required/Optional Description
Devices string array required This is a list of the device
serial numbers.
ParamSections JSON object array required If this object is empty or is
omitted from the PUT, no
update will occur, and an
error message will be
returned.
Example
JSON data to be posted to https://api.oemserver.com/v1.0/TrackingDevice/SetAdminParameters/62
{
"Devices": [
"232759"
],
"ParamSections": [
{
"Id": 1000,
"Params": {
"APN_String": "APN_Updated_API2"
}
}
]
}
Request Endpoint
Name Method Description
v1.0/TrackingDevice/SetDeviceParameters/ProductId POST Posts data to the OEM
Web API that is used to
replace device parameters.
Url Parameter
Name Data Type Required/Optional Description
ProductId number required This is the id of the product
that exists in OEM.
Body
Name Data Type Required/Optional Description
Devices string array required This is a list of the device
serial numbers.
ParamSections JSON object array optional If this object is empty or is
omitted from the POST, the
device parameters from
the list of devices will be
set to their default values.
10
Example
JSON data to be posted to https://api.oemserver.com/v1.0/TrackingDevice/SetDeviceParameters/62
{
"Devices": [
"232759"
],
"ParamSections": [
{
"Id": 2075,
"Params": {
"bPeriodicUploadHrMin": "100"
}
},
{
"Id": 2300,
"Params": {
"bMovementCount": "100"
}
},
{
"Id": 2400,
"Params": {
"bTripEndTimeSec_10": "100"
}
}
]
}
The above example will set the existing device system parameters for the Remora2 device with serial
number 232759 using the provided JSON. Any omitted device parameters will be set to their
defaults.
6.2.1.5 SetDeviceParameters (PUT)
A PUT method added to update the values of device system parameters set on devices that exists in
OEM with the provided ProductId.
Request Endpoint
Name Method Description
v1.0/TrackingDevice/SetDeviceParameters/ProductId PUT Posts data to the OEM
Web API that is used to
update device parameters.
Url Parameter
Name Data Type Required/Optional Description
ProductId number required This is the id of the product
that exists in OEM.
Body
Name Data Type Required/Optional Description
Devices string array required This is a list of the device
serial numbers.
ParamSections JSON object array required If this object is empty or is
omitted from the PUT, no
update will occur, and an
11
error message will be
returned.
Example
JSON data to be posted to https://api.oemserver.com/v1.0/TrackingDevice/SetDeviceParameters/62
{
"Devices": [
"232759"
],
"ParamSections": [
{
"Id": 2400,
"Params": {
"bTripEndTimeSec_10": "100"
}
}
]
}
The above example will set the existing device parameters for the Remora2 device with serial
number 232759 using the provided JSON. Any omitted device parameters will keep their existing
values.
Set Connector:
https://api.oemserver.com/v1.0/connector/set/<id>?serial=<serial>
{
“Devices”: [102471, 123456]
}
Set Enabled:
https://api.oemserver.com/v1.0/<product name>/setenabled/<serial>?enabled=<true/false>
eg.: https://api.oemserver.com/v1.0/g60/setenabled/102471?enabled=true
12
This may be used to assign an equipment ID against a serial in OEM, so the ID can be sent as part of
the payload when using the HTTP connector. These fields can be included in the URL or sent as a
HTTP header for easy identification by the end platform.
Response: {"Custom1":"test1","Custom2":"test2","Custom3":null}
https://api.oemserver.com/v1.0/trackingdevice/setbatchstring/<productId>/<serial>/?batchString=<
batchstring> - Set <batchstring> on <productId> and <serial>
This allows for devices to be immobilised, and only started when a valid driver ID is presented. These
calls allow us to send the list of valid IDs down to the device.
This can alternatively be done via CSV import in the OEM UI (Device Operations -> Set Drivers)
13
Required fields:
1. ID Type
a. 1 = DMRFID
b. 2 = iButton
c. 3 = FourDigitPin (deprecated, only for use with discontinued DM Keypad)
d. 4 = FiveDigitPin (deprecated, only for use with discontinued DM Keypad)
e. 7 = Wiegand
2. IdData
a. The iButton code, RFID serial etc.
3. Flags
a. 1 = enabled to drive
b. 0 = not enabled to drive
4. Layout
a. Driver ID List Layout, use 0
Example cURL
curl -X POST 'https://api.oemserver.com/v1.0/driverlist/set/310056' -
H 'Authorization: Basic user/pass' -H 'Content-Type: application/json' --data-
raw '{"Drivers": [{"IdType": 7, "IdData": "FBI0UA==", "Flags": "01"},{"IdType":1,"IdData":"001CB
70A7B","Flags":"01"}], "Layout": 0}'
Example cURL
curl -X GET 'https://api.oemserver.com/v1.0/driverlist/get/310056' -
H 'Authorization: Basic <user/pass>' --data-raw ''
Response
{"Layout":0,"Drivers":[{"IdType":7,"IdData":"FBI0UAAA","Name":null,"Flags":1}]}
14
7 ASYNC MESSAGING TO DEVICES
The OEM Server and DM devices make use of an ASYNC messaging protocol to send messages
between the device and server. This enables various command and control of the device including:
Many of these messages are handled in the interaction between the device and OEM server.
However, the OEM WebAPI allows any async message to be queued via API call. Once the call is
made the message is queued on OEM server until the device connects in - then it is delivered to the
device.
Message Structure
URL: https://api.oemserver.com/v1.0/asyncmessaging/send/[device serial]
The DM ASYNC message structure must be adhered to which requires the following:
• Message Type
• CAN Address - this is always 0 x FFFFFFFF - meaning it is a message to be sent to a device.
• Message Expiry - time for the message to expire if left unprocessed (i.e. device doesn't
connect in)
The message structure is the same as in the Direct Third-Party Server documentation. To use the API,
we must simply pass the same data in JSON format, and OEM will forward this to the device.
The queue and history of messages is displayed (you can toggle between queue and history with the
button)
15
Some messages have descriptions indicating what they are for.
When posting an asynchronous message to a device via the OEM WebAPI – the response only
indicates that the payload was valid, and that OEM has received the message. It does not indicate
that it has been passed down to the device and the device has actioned the message.
The ASYNC message queue goes into more detail, and how to tell whether or not the device has
actioned a command is described with each message where appropriate.
16
7.2 0x001 – Resync Device Slots
This triggers the device to resync slots (FW, parameters, and driver lists). If the device is in trip they
may not be updated until the end of the trip.
Example:
Body:
{
"MessageType":1, // 0x0001 remote reset
"CANAddress":4294967295, //0xFFFFFFFF, HOST_ADDRESS - message to device
"ExpiryDateUTC":"2018-07-20T18:25:43.511Z" // message expiry
}
Payload is empty - we are only sending the message type, host address and expiry.
Example
Body:
{
"MessageType":2, // 0x0002 remote reset
"CANAddress":4294967295, //0xFFFFFFFF, HOST_ADDRESS - message to device
"ExpiryDateUTC":"2018-07-20T18:25:43.511Z" // message expiry
}
Payload is empty - we are only sending the message type, host address and expiry.
This message remotely sets the operational mode of the device. Currently this is used to switch
between normal operation and recovery mode. The device supports a mode timeout parameter.
This is currently only valid with a switch to recovery mode as the device will switch into NORMAL
mode after the timeout has elapsed.
Payload:
Offset Length Data Type Description
0 1 BYTE Set operational mode:
NORMAL = 1,
RECOVERY = 3
1 4 UINT Absolute time in seconds since 1 Jan 2013 after which the mode
should be cancelled.
17
Switch mode, no expiry.
{
"MessageType":3, // Set Operational Mode 0x0003
"CANAddress":4294967295, //0xFFFFFFFF,//HOST_ADDRESS - send to device
"Data":[1], // 1 for standard Mode, 3 for Recovery mode
"ExpiryDateUTC":"2018-07-20T18:25:43.511Z" // Absolute time in seconds
since 1 Jan 2013 after which the mode should be cancelled.
}
In this example, the async message itself will expire on March 19, 2020, 00:00 UTC.
So, if it is not actioned on the device by this time, it will expire.
Expiry time as above is 227428800 seconds since 1/1/13 00:00 UTC. Converting to hex and little
endian, C0 49 8E 0D
See Times in the DM Protocol for more information and the calculator pictured below
Giving:
[03, 192, 73, 142, 13]
18
7.4.1 Set Operational Mode – Confirming the device has actioned recovery mode.
The response to the API call only indicates OEM has received the message. On the server, we want
to keep track of whether the device is/isn’t currently in recovery mode. This information is reported
in the device payload in a few ways
This message remotely sets digital outputs on a device. The output numbers are physical outputs (no
logical remapping). The firmware translates the logical level into a physical level depending on the
active high setting in system parameters. The changed mask allows the server to change required
outputs and not affect others.
For this message to have any effect - the output being changed must be set up as
Digital Output under the Digital Output parameters.
Payload:
JSON Example
{
"MessageType":4,
"CANAddress":4294967295,//0xFFFFFFFF,//HOST_ADDRESS
"Data":[15,15,6,0],
"ExpiryDateUTC":"2020-03-18T18:25:43.511Z"
}
19
This results in:
Change mask of 0xFF - i.e. set all outputs according to the logical level.
Output 1 and 2 (0110 = 6) are turned on.
7.5.1 Set Output – confirming the device has actioned the change
We can keep track as to whether our change has been applied and the state of our outputs in a few
places:
If enabled, a log with Log Reason 10 - Digital Output Changed will be generated on a change.
Both Odo and Run Hours can also be set via SMS, see here - On Device Odometer and Run Hours
Payload:
Offset Length Data Type Description
0 N BYTE[] Third Party
20
7.9 0x0016 – Geofence Download
This triggers a connection to the geofence server (if configured). For more information see here.
Payload:
Offset Length Data Type Description
0 1 BOOL True = immobiliser on. This is the logical level – physical levels
(active high/low) are determined by system parameters.
JSON example
{
"MessageType":256, // 0x0100 – Immobilise,
"CANAddress":4294967295, //0xFFFFFFFF,//HOST_ADDRESS
"Flags":01,
"Data":[1], // 1 to immobilise, 0 to turn off immobilisation
"ExpiryDateUTC":"2018-07-20T18:25:43.511Z"
}
21