URL: "/devices/smartsearch?v=2.1"
HTTP Method: POST
This end-point provides the capability to search for Devices either using a human-readable query string or using an Elasticsearch full-fledged query format. It's the responsibility of the client to provide a valid Elasticsearch query. In the query string format, different attributes of Device can be combined using AND/OR operators in the query. In the Elasticsearch query format, Terms, Wildcard, Match etc. queries can be provided in addition to the aggregations and/or pagination/sort parameters. The search results can be restricted to specific account(s) by providing the accountId(s) in addition to the query.
This end-point is only supported for version >= 2.1
By default, search result shall be sorted by deviceId with page size of 10.
This end-point supports following optional request parameters.
- pg = page number (default value is 1)
- pgSize = page size (default value is 10) (maximum 100 per page is allowed)
- sort = Returns the sorted devices based on requested field
eg : id, name, etc - hierLevel = Returns all the devices belong to specified accountId and it's sub accounts.
eg : 0 to ALL
0 -> specified account only
1 -> specified account and it's immediate sub account only
ALL -> specified account and all of it's sub accounts - withLocation = If true, devices with Location will be returned
- withIdReport = If true, devices with ID Report will be returned
- expand = Returns expanded value for requested field.
eg : deviceConfiguration - include = deviceSettings (Shows SCI device specific settings and status of any pending configuration changes)
- searchAfter = required to fetch more than 10k devices
For more info regarding searchAfter, please go to Deep Pagination.
Request body:
- Sample input request body containing query string, aggregations, accountId & hierLevel.
Sample request body containing full-fledged Elasticsearch query with aggregations, accountId & hierLevel:
{ "search": { "queryString": "name:Device* AND esn:123456789", "aggregations": "{\"statuses\": {\"terms\": {\"field\": \"status\"}}}", "accountId": 2, "hierLevel": "1" } }
Sample response body:{ "search": { "query": { "query": { "bool": { "must": [ { "wildcard": { "name": { "value": "Device*" } } }, { "term": { "esn": 123456789 } } ] } }, "aggs": { "statuses": { "terms": { "field": "status" } } } }, "accountId": 2, "hierLevel": "1" } }
{ "response": { "searchableProperties": { "account (long\[])": "", "extensions.firmwareVersion (string\[])": "", "extensions.networkMode (string\[])": "", "schedules.title (string\[])": "", "replacedDevice.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "asset.id (long\[])": "", "pegBehaviorId (long\[])": "", "mdn (string\[])": "Searchable without property name", "type.title (string\[])": "", "replacedDevice.id (long\[])": "", "ipAddress (string\[])": "Searchable without property name", "activationDate (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "asset.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "account.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "name (string\[])": "Searchable without property name", "pegBehavior.title (string\[])": "", "asset.title (string\[])": "", "pegBehavior (long\[])": "", "extensions.platforms (string\[])": "", "pegBehavior.id (long\[])": "", "userESN (string\[])": "Searchable without property name", "deviceConfigurationId (long\[])": "", "groups.id (long\[])": "", "lastModifiedOn (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "pegBehavior.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "provisionStatus (string\[])": "", "status (resourcestatus\[])": "", "schedules.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "serialNumber (string\[])": "Searchable without property name", "userDefinedMobileId (string\[])": "Searchable without property name", "extensions.vbusEnabledStatus (string\[])": "", "extensions.poNumber (string\[])": "", "category (devicecategory\[])": "", "createdOn (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "architecture (devicearchitecture\[])": "", "extensions.shippingOrder (string\[])": "", "extensions.networkCarrier (string\[])": "", "extensions.androidOSVersion (string\[])": "", "deviceConfiguration.title (string\[])": "", "esn (string\[])": "Searchable without property name", "iccid (string\[])": "Searchable without property name", "typeId (long\[])": "", "airId (string\[])": "Searchable without property name", "groupIds (list\[])": "", "dmDevice (boolean\[])": "", "deviceConfiguration.id (long\[])": "", "extensions.signalStrength (string\[])": "", "lastReportedTime (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "account.title (string\[])": "", "accountId (long\[])": "", "imei (string\[])": "Searchable without property name", "extensions.configVersion (string\[])": "", "extensions.vbusMode (string\[])": "", "ioProfile.title (string\[])": "", "account.id (long\[])": "", "id (long\[])": "Searchable without property name", "serviceProfile.id (long\[])": "", "extensions.sku (string\[])": "", "externalId (string\[])": "Searchable without property name", "groups.title (string\[])": "", "extensions.kernelVersion (string\[])": "", "macAddress (string\[])": "Searchable without property name", "shipDate (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "typeName (string\[])": "", "deviceConfiguration (long\[])": "", "serviceProfile.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "extensions.esnAssociatedLMU (string\[])": "Searchable without property name", "groups (list\[])": "", "type.id (long\[])": "", "replacedDevice.title (string\[])": "", "schedules.id (long\[])": "", "ioProfile.id (long\[])": "", "meid (string\[])": "Searchable without property name", "type (long\[])": "", "extensions.idReportTimestamp (date\[])": "", "extensions.networkCurrentMode (string\[])": "", "extensions.fileVersions (string\[])": "", "extensions.appId (string\[])": "", "min (long\[])": "Searchable without property name", "extensions.associatedDevices (string\[])": "", "imsi (string\[])": "Searchable without property name", "serviceProfile.title (string\[])": "", "ioProfile.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "extensions.batteryPercentageLeft (integer\[])": "Searchable without property name", "groups.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "phoneNumber (string\[])": "Searchable without property name" }, "queryTime": 21, "totalCount": 9402, "results": [ { "device1" }, { "device2" },..... { "device10" } ], "aggregations": { "statuses": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [ { "key": "Enabled", "doc_count": 9187 }, { "key": "Suspended", "doc_count": 108 }, { "key": "Disabled", "doc_count": 107 } ] } }, "\_links": [ { "href": "https://dev.connect.calamp.com/connect/services/devices/smartsearch?v=2.1", "rel": "self" }, { "href": "https://dev.connect.calamp.com/connect/services/devices/smartsearch?v=2.1&pg=1", "rel": "first" }, { "href": "https://dev.connect.calamp.com/connect/services/devices/smartsearch?v=2.1&pg=2", "rel": "next" }, { "href": "https://dev.connect.calamp.com/connect/services/devices/smartsearch?v=2.1&pg=941", "rel": "last" } ] } }
- Sample input request body containing nested type field (arrays of objects) search and nested type field sorting.
The list of fields which are nested type in smart search and searchable only using full-fledged Elasticsearch query.- groups (id, title, status)
- schedules (id, title, status)
- extensions.fileVersions (platform, version, fileName, fileStatus)
- extensions.platforms (platformId, platformType)
- extensions.associatedDevices (mobileId, mobileIdType, deviceCategory)
Sample response body:{ "search": { "query": { "query": { "bool": { "should": [ { "nested": { "path": "extensions.fileVersions", "query": { "term": { "extensions.fileVersions.platform": "100" } } } } ] } }, "sort": [ { "extensions.fileVersions.platform": { "order": "asc", "nested_path": "extensions.fileVersions" } }, { "id": { "order": "desc" } } ] } } }
{ "response": { "searchableProperties": { "account (long\[])": "", "extensions.firmwareVersion (string\[])": "", "extensions.networkMode (string\[])": "", "schedules.title (string\[])": "", "replacedDevice.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "asset.id (long\[])": "", "pegBehaviorId (long\[])": "", "mdn (string\[])": "Searchable without property name", "type.title (string\[])": "", "replacedDevice.id (long\[])": "", "ipAddress (string\[])": "Searchable without property name", "activationDate (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "asset.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "account.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "name (string\[])": "Searchable without property name", "pegBehavior.title (string\[])": "", "asset.title (string\[])": "", "pegBehavior (long\[])": "", "extensions.platforms (string\[])": "", "pegBehavior.id (long\[])": "", "userESN (string\[])": "Searchable without property name", "deviceConfigurationId (long\[])": "", "groups.id (long\[])": "", "lastModifiedOn (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "pegBehavior.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "provisionStatus (string\[])": "", "status (resourcestatus\[])": "", "schedules.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "serialNumber (string\[])": "Searchable without property name", "userDefinedMobileId (string\[])": "Searchable without property name", "extensions.vbusEnabledStatus (string\[])": "", "extensions.poNumber (string\[])": "", "category (devicecategory\[])": "", "createdOn (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "architecture (devicearchitecture\[])": "", "extensions.shippingOrder (string\[])": "", "extensions.networkCarrier (string\[])": "", "extensions.androidOSVersion (string\[])": "", "deviceConfiguration.title (string\[])": "", "esn (string\[])": "Searchable without property name", "iccid (string\[])": "Searchable without property name", "typeId (long\[])": "", "airId (string\[])": "Searchable without property name", "groupIds (list\[])": "", "dmDevice (boolean\[])": "", "deviceConfiguration.id (long\[])": "", "extensions.signalStrength (string\[])": "", "lastReportedTime (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "account.title (string\[])": "", "accountId (long\[])": "", "imei (string\[])": "Searchable without property name", "extensions.configVersion (string\[])": "", "extensions.vbusMode (string\[])": "", "ioProfile.title (string\[])": "", "account.id (long\[])": "", "id (long\[])": "Searchable without property name", "serviceProfile.id (long\[])": "", "extensions.sku (string\[])": "", "externalId (string\[])": "Searchable without property name", "groups.title (string\[])": "", "extensions.kernelVersion (string\[])": "", "macAddress (string\[])": "Searchable without property name", "shipDate (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "typeName (string\[])": "", "deviceConfiguration (long\[])": "", "serviceProfile.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "extensions.esnAssociatedLMU (string\[])": "Searchable without property name", "groups (list\[])": "", "type.id (long\[])": "", "replacedDevice.title (string\[])": "", "schedules.id (long\[])": "", "ioProfile.id (long\[])": "", "meid (string\[])": "Searchable without property name", "type (long\[])": "", "extensions.idReportTimestamp (date\[])": "", "extensions.networkCurrentMode (string\[])": "", "extensions.fileVersions (string\[])": "", "extensions.appId (string\[])": "", "min (long\[])": "Searchable without property name", "extensions.associatedDevices (string\[])": "", "imsi (string\[])": "Searchable without property name", "serviceProfile.title (string\[])": "", "ioProfile.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "extensions.batteryPercentageLeft (integer\[])": "Searchable without property name", "groups.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete", "phoneNumber (string\[])": "Searchable without property name" }, "queryTime": 3912, "totalCount": 893, "results": [ { "device1" }, { "device2" },..... { "device10" } ], "\_links": [ { "href": "https://dev.connect.calamp.com/connect/services/devices/smartsearch?v=2.1", "rel": "self" }, { "href": "https://dev.connect.calamp.com/connect/services/devices/smartsearch?v=2.1&pg=1", "rel": "first" }, { "href": "https://dev.connect.calamp.com/connect/services/devices/smartsearch?v=2.1&pg=2", "rel": "next" }, { "href": "https://dev.connect.calamp.com/connect/services/devices/smartsearch?v=2.1&pg=90", "rel": "last" } ] } }
- Sample input request body containing ComboField search.
The List of fields currently used in the ComboField index :
id, airId, esn, externalId, iccid, imei, imsi, ipAddress, mdn, meid, min, name, phoneNumber, serialNumber, macAddress, userDefinedMobileId, extensions.appId, extensions.androidOSVersion, extensions.fileVersions.platform, extensions.fileVersions.version, extensions.fileVersions.fileName, extensions.fileVersions.fileStatus, extensions.esnAssociatedLMU, extensions.associatedDevices.mobileId, extensions.batteryPercentageLeft, userESN, groups.title.Sample response body:{ "search": { "query": { "query": { "query_string": { "query": "4444444444 OR 4061840045 OR 46748123700 OR 5238206517 OR 3010202412 OR 1704885884", "default_field": "_comboField" } }, "sort": [ { "name": { "order": "asc" } }, { "id": { "order": "asc" } } ] }, "accountId": 2 } }
{
"response": {
"searchableProperties": {
"account (long\[])": "",
"extensions.firmwareVersion (string\[])": "",
"extensions.networkMode (string\[])": "",
"schedules.title (string\[])": "",
"replacedDevice.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"asset.id (long\[])": "",
"pegBehaviorId (long\[])": "",
"mdn (string\[])": "Searchable without property name",
"type.title (string\[])": "",
"replacedDevice.id (long\[])": "",
"ipAddress (string\[])": "Searchable without property name",
"activationDate (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"asset.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"account.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"name (string\[])": "Searchable without property name",
"pegBehavior.title (string\[])": "",
"asset.title (string\[])": "",
"pegBehavior (long\[])": "",
"extensions.platforms (string\[])": "",
"pegBehavior.id (long\[])": "",
"userESN (string\[])": "Searchable without property name",
"deviceConfigurationId (long\[])": "",
"groups.id (long\[])": "",
"lastModifiedOn (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"pegBehavior.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"provisionStatus (string\[])": "",
"status (resourcestatus\[])": "",
"schedules.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"serialNumber (string\[])": "Searchable without property name",
"userDefinedMobileId (string\[])": "Searchable without property name",
"extensions.vbusEnabledStatus (string\[])": "",
"extensions.poNumber (string\[])": "",
"category (devicecategory\[])": "",
"createdOn (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"architecture (devicearchitecture\[])": "",
"extensions.shippingOrder (string\[])": "",
"extensions.networkCarrier (string\[])": "",
"extensions.androidOSVersion (string\[])": "",
"deviceConfiguration.title (string\[])": "",
"esn (string\[])": "Searchable without property name",
"iccid (string\[])": "Searchable without property name",
"typeId (long\[])": "",
"airId (string\[])": "Searchable without property name",
"groupIds (list\[])": "",
"dmDevice (boolean\[])": "",
"deviceConfiguration.id (long\[])": "",
"extensions.signalStrength (string\[])": "",
"lastReportedTime (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"account.title (string\[])": "",
"accountId (long\[])": "",
"imei (string\[])": "Searchable without property name",
"extensions.configVersion (string\[])": "",
"extensions.vbusMode (string\[])": "",
"ioProfile.title (string\[])": "",
"account.id (long\[])": "",
"id (long\[])": "Searchable without property name",
"serviceProfile.id (long\[])": "",
"extensions.sku (string\[])": "",
"externalId (string\[])": "Searchable without property name",
"groups.title (string\[])": "",
"extensions.kernelVersion (string\[])": "",
"macAddress (string\[])": "Searchable without property name",
"shipDate (date\[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"typeName (string\[])": "",
"deviceConfiguration (long\[])": "",
"serviceProfile.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"extensions.esnAssociatedLMU (string\[])": "Searchable without property name",
"groups (list\[])": "",
"type.id (long\[])": "",
"replacedDevice.title (string\[])": "",
"schedules.id (long\[])": "",
"ioProfile.id (long\[])": "",
"meid (string\[])": "Searchable without property name",
"type (long\[])": "",
"extensions.idReportTimestamp (date\[])": "",
"extensions.networkCurrentMode (string\[])": "",
"extensions.fileVersions (string\[])": "",
"extensions.appId (string\[])": "",
"min (long\[])": "Searchable without property name",
"extensions.associatedDevices (string\[])": "",
"imsi (string\[])": "Searchable without property name",
"serviceProfile.title (string\[])": "",
"ioProfile.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"extensions.batteryPercentageLeft (integer\[])": "Searchable without property name",
"groups.status (resourcestatus\[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"phoneNumber (string\[])": "Searchable without property name"
},
"queryTime": 3912,
"totalCount": 893,
"results": [
{
"device1"
},
{
"device2"
},.....
{
"device10"
}
],
"\_links": [
{
"href": "https://dev.connect.calamp.com/connect/services/devices/smartsearch?v=2.1",
"rel": "self"
},
{
"href": "https://dev.connect.calamp.com/connect/services/devices/smartsearch?v=2.1&pg=1",
"rel": "first"
},
{
"href": "https://dev.connect.calamp.com/connect/services/devices/smartsearch?v=2.1&pg=2",
"rel": "next"
},
{
"href": "https://dev.connect.calamp.com/connect/services/devices/smartsearch?v=2.1&pg=90",
"rel": "last"
}
]
}
}
End-Point: "/devices/smartsearch/searchableproperties?v=2.1"
HTTP Method: GET
This end-point will return the properties that SmartSearch device resource can be searched on.
This end-point is only supported for version >= 2.1
{
"response": {
"searchableProperties": {
"account (long[])": "",
"extensions.firmwareVersion (string[])": "",
"extensions.networkMode (string[])": "",
"schedules.title (string[])": "",
"replacedDevice.status (resourcestatus[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"asset.id (long[])": "",
"pegBehaviorId (long[])": "",
"mdn (string[])": "Searchable without property name",
"type.title (string[])": "",
"replacedDevice.id (long[])": "",
"ipAddress (string[])": "Searchable without property name",
"activationDate (date[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"asset.status (resourcestatus[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"account.status (resourcestatus[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"name (string[])": "Searchable without property name",
"pegBehavior.title (string[])": "",
"asset.title (string[])": "",
"pegBehavior (long[])": "",
"extensions.platforms (string[])": "",
"pegBehavior.id (long[])": "",
"userESN (string[])": "Searchable without property name",
"deviceConfigurationId (long[])": "",
"groups.id (long[])": "",
"lastModifiedOn (date[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"pegBehavior.status (resourcestatus[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"provisionStatus (string[])": "",
"status (resourcestatus[])": "",
"schedules.status (resourcestatus[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"serialNumber (string[])": "Searchable without property name",
"userDefinedMobileId (string[])": "Searchable without property name",
"extensions.vbusEnabledStatus (string[])": "",
"extensions.poNumber (string[])": "",
"category (devicecategory[])": "",
"createdOn (date[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"architecture (devicearchitecture[])": "",
"extensions.shippingOrder (string[])": "",
"extensions.networkCarrier (string[])": "",
"extensions.androidOSVersion (string[])": "",
"deviceConfiguration.title (string[])": "",
"esn (string[])": "Searchable without property name",
"iccid (string[])": "Searchable without property name",
"typeId (long[])": "",
"airId (string[])": "Searchable without property name",
"groupIds (list[])": "",
"dmDevice (boolean[])": "",
"deviceConfiguration.id (long[])": "",
"extensions.signalStrength (string[])": "",
"lastReportedTime (date[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"account.title (string[])": "",
"accountId (long[])": "",
"imei (string[])": "Searchable without property name",
"extensions.configVersion (string[])": "",
"extensions.vbusMode (string[])": "",
"ioProfile.title (string[])": "",
"account.id (long[])": "",
"id (long[])": "Searchable without property name",
"serviceProfile.id (long[])": "",
"extensions.sku (string[])": "",
"externalId (string[])": "Searchable without property name",
"groups.title (string[])": "",
"extensions.kernelVersion (string[])": "",
"macAddress (string[])": "Searchable without property name",
"shipDate (date[])": "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"typeName (string[])": "",
"deviceConfiguration (long[])": "",
"serviceProfile.status (resourcestatus[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"extensions.esnAssociatedLMU (string[])": "Searchable without property name",
"groups (list[])": "",
"type.id (long[])": "",
"replacedDevice.title (string[])": "",
"schedules.id (long[])": "",
"ioProfile.id (long[])": "",
"meid (string[])": "Searchable without property name",
"type (long[])": "",
"extensions.idReportTimestamp (date[])": "",
"extensions.networkCurrentMode (string[])": "",
"extensions.fileVersions (string[])": "",
"extensions.appId (string[])": "",
"min (long[])": "Searchable without property name",
"extensions.associatedDevices (string[])": "",
"imsi (string[])": "Searchable without property name",
"serviceProfile.title (string[])": "",
"ioProfile.status (resourcestatus[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"extensions.batteryPercentageLeft (integer[])": "Searchable without property name",
"groups.status (resourcestatus[])": "Enabled,Disabled,Suspended,Deleted,Pending_Delete",
"phoneNumber (string[])": "Searchable without property name"
},
"totalCount": 0,
"results": []
}
}