Overview

This section provides general information about interfacing with both the ADI OtoSense™ Smart Motor Sensor Server API (which is integrated into the Smart Motor Sensor’s firmware) and the ADI OtoSense™ Cloud API.

Warning: REST calls made to the Smart Motor Sensor Server API and those made to the ADI OtoSense™ Cloud API involve different base paths. See Table 2 for additional details.

Request and response format

When interfacing with the Smart Motor Sensor Server API, mobile and desktop applications should use a combination of JSON (‘application/json’) and URL (‘application/x-www-form-urlencoded’) encoded requests and responses. To determine the appropriate format for a particular request, see the “Format” column in Table 3.

When interfacing with the ADI OtoSense™ Cloud API, mobile and desktop applications should only use JSON (‘application/json’) encoded requests and responses.

Note: When making POST requests, set the Content-Type header to the appropriate format (i.e., application/json or application/x-www-form-urlencoded).

HTTP response status codes

Table 1: HTTP response status codes

Code Description Result
200 Ok Successful
204 No Content Successful
400 Bad Request Unsuccessful
404 Not Found Unsuccessful

Table 2: Base URLs for Rest Endpoints

Location Base URLs for REST Endpoints Notes
Sensor http://10.123.45.1 †The hostname, `http://mysimplelink.net` can also be used but it often fails to resolve. Thus it is recommended to use the IP address instead.
Cloud Your API Endpoint*
(ex. https://api-adi.otosensesms.com/)
*See ‘Before you begin’ for more details.

Table 3: REST Calls to the Smart Motor Sensor Server API

Description Method Path Format* Parameters / Notes
Get Sensor Name GET /__SL_G_DNP TEXT The prefix on the name, ‘SMS’, should be removed from the response.
Get Sensor Firmware and Hardware Version Numbers GET /api/1/host/version/1/sms_version JSON Optional. Can be used to determine if a connection has been made to the sensor.
Get Sensor Certificate GET /api/1/host/certs/1/clientcert JSON Any instances of the string ‘%02’ should be removed from the response and replaced with a space (‘ ‘).
Set Sensor IoT Endpoint POST /api/1/host/cloud/1/config JSON url: The IoT Endpoint
Delete Sensor Network Profiles POST /api/1/wlan/profile_del_all FORM
Start AP Scan POST /api/1/wlan/en_ap_scan FORM Optional. Parameters should be set as follows:

__SL_P_SC1=10
__SL_P_SC2=1
Get Sensor Scan Result GET /netlist.txt TEXT Optional. Should be called after ‘Start AP Scan’.
Results will be ‘;’ separated strings with AP names prefixed with security type integer (ex. ‘2MyAP;3EntAP’)
Set Sensor Network Profile POST /api/1/wlan/profile_add FORM __SL_P_P.A= SSID
__SL_P_P.B= Security Type
__SL_P_P.C= Password
__SL_P_P.D= Priority
Confirm Sensor Network Profile POST /api/1/wlan/confirm_req FORM Once this request is made, the sensor will stop broadcasting its AP and attempt to connect to the ADI OtoSense™ cloud.
Get Sensor Profile Error GET /api/​1​/host/info/​1​/error_info JSON If the sensor cannot successfully connect to the internet, this can be used to determine the reason why a profile did not work.

*JSON refers to ‘application/json’ encoding and FORM refers to ‘application/x-www-form-urlencoded’ encoding.

Table 4: REST Calls to the ADI OtoSense™ Cloud API

Description Method Path Format Parameters / Notes
Get Oauth Token POST /oauth/token JSON see https://adi.otosensesms.com/api-reference for more details
Provision Sensor POST /sensors JSON see https://adi.otosensesms.com/api-reference for more details
Confirm Sensor is Connected to the Cloud GET /sensors/{sensorId} JSON see https://adi.otosensesms.com/api-reference for more details