GET /search_results

Searches for entities visible to the authenticated user.

Parameters

auth

(required)

The authentication token received in response to the call to POST authentication_credentials or GET authentication_token. Applications should pass the authentication token in the custom "X-auth" HTTP header to avoid passing it in in the query string.

system_type

(optional)

Indicates that only entities from the specified system should be returned.

entity_types

(optional)

A comma separated list of entity types to search for. Valid entity types are 'all', 'organisations' (ignored by the X-Drive system), 'sites' (ignored by Asset Management and X-Drive systems), 'devices', 'vehicles', 'drivers', or 'locations'. Defaults to 'all'.

match

(optional)

The word 'any', 'all' or 'ids'. 'any' or 'all' searches for entities which match any or all of the specified keywords. 'ids' searches for entities with identifiers matching those specified in the organisation_ids, site_ids, device_ids, vehicle_ids, driver_ids and/or location_ids parameters. Defaults to 'any'.

keywords

(optional)

A comma separated list of keywords to be used when searching for entities. NOTE: This parameter can only be used when 'any' or 'all' is passed in the match parameter.

organisation_ids

(optional) *

A comma separated list of organisation identifiers to be used when searching for organisations. NOTE: This parameter can only be used when 'ids' is passed in the match parameter. * Ignored when retrieving data from the X-Drive system.

site_ids

(optional) *

A comma separated list of site identifiers to be used when searching for sites. NOTE: This parameter can only be used when 'ids' is passed in the match parameter. * Ignored when retrieving data from the AssetManagement or X-Drive system.

device_ids

(optional)

A comma separated list of device identifiers to be used when searching for devices. NOTE: This parameter can only be used when 'ids' is passed in the match parameter.

vehicle_ids

(optional)

A comma separated list of vehicle identifiers to be used when searching for vehicles. NOTE: This parameter can only be used when 'ids' is passed in the match parameter.

driver_ids

(optional)

A comma separated list of driver identifiers to be used when searching for drivers. NOTE: This parameter can only be used when 'ids' is passed in the match parameter.

location_ids

(optional)

A comma separated list of location identifiers to be used when searching for locations. NOTE: This parameter can only be used when 'ids' is passed in the match parameter.

organisation_id

(optional) *

Indicates that only entities belonging to the specified organisation should be returned. * Required when retrieving data from the Fleet Manager system. Ignored when retrieving data from the X-Drive system.

include_positions

(optional)

Indicates whether or not to include the last known position of each vehicle and driver that is returned. Passing a value of 1, t, or true will result in positions being included.

include_associated

(optional) *

Indicates whether or not to include the vehicle/driver associated with each vehicle/driver that is returned. Passing a value of 1, t, or true will result in the associated vehicle/driver being included. NOTE: This parameter can only be used in conjunction with the include_positions parameter. * Ignored when retrieving data from the X-Drive system.

callback

(optional)

Only available for JSON format. If supplied, the response will use JSONP format with a callback of the given name.

date_format

(optional)

Only available for JSON format. If supplied, the response will contain JSON dates serialized in the specified format. 0 = Timestamp with offset e.g. "\/Date(1346080140000+0500)\/". 2 = ISO8601 e.g. "2012-08-27T15:09:00.0000000+05:00". Applications may pass this parameter in the custom "X-DateFormat" custom HTTP header instead of this query parameter.

globalisation

(optional)

The authenticated user's globalisation preferences as received in response to the call to GET account/profile or in the custom "X-Globalisation" HTTP header returned in response to authenticated calls. Applications should pass this back to the server with every call, either in this parameter, or in the the custom "X-Globalisation" HTTP header if automatic conversion of values is required.

Request Content Type

N/A

Response

Returns a SearchResults resource in the requested format.

Response Content Type

application/json, application/javascript (JSONP) or application/xml as requested

Give It A Try...

Enter appropriate parameter values then click on the link which appears to try the API call...

Note: You must have JavaScript support enabled in your browser to use this feature.

auth

(required)

system_type

(optional)

entity_types

(optional)

match

(optional)

keywords

(optional)

organisation_ids

(optional) *

site_ids

(optional) *

device_ids

(optional)

vehicle_ids

(optional)

driver_ids

(optional)

location_ids

(optional)

organisation_id

(optional) *

include_positions

(optional)

include_associated

(optional) *

callback

(optional)

date_format

(optional)

globalisation

(optional)

Response format

 

Request Examples

// Find all entities that match 'fred'
GET /search_results?auth=e722fa0c702f42b68e2fdb771a80caed&keywords=fred

// Find vehicles and drivers matching 'fred' OR 'pete'
GET /search_results.json?auth=e722fa0c702f42b68e2fdb771a80caed&keywords=fred,pete&entity_types=vehicle,driver

// Find locations matching 'john' AND 'home'
GET /search_results.json?auth=e722fa0c702f42b68e2fdb771a80caed&match=all&keywords=john,home&entity_types=locations

// Find vehicles with id 1,3 or 9 and drivers with id 200 or 300. Include their latest positions and their associated vehicle/driver
GET /search_results.xml?auth=e722fa0c702f42b68e2fdb771a80caed&match=ids&vehicle_ids=1,3,9&driver_ids=200,300&include_positions=1&include_associated=1

Response Examples

JSON body:

{"Devices":[],
"Vehicles":[{"SystemType":"XDrive","VehicleId":"df8c7fa2-c800-48d7-a67c-ff0b694a3d04","RegistrationNumber":"","Description":"Fred's Car","InstalledDeviceType":"XDrive","InstalledDeviceId":"49cd7ca3-7b72-4cd9-ad98-b93d39d611d0"},{"SystemType":"XDrive","VehicleId":"1186b7b8-2e4a-491e-84b5-4031f5d452fc","RegistrationNumber":"","Description":"Fred's Truck","InstalledDeviceType":"XDrive","InstalledDeviceId":"3d94c43b-3e2e-4d44-ac7a-a1ead9509443"}],
"Drivers":[{"SystemType":"XDrive","DriverId":"47914ad5-cb80-4e8c-bb43-a422c2568cde","Name":"Fred","DeviceDriverId":"1536"}]}

XML body:

<SearchResults xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Vehicles>
	<Vehicle SystemType="XDrive" VehicleId="df8c7fa2-c800-48d7-a67c-ff0b694a3d04">
		<Description>Fred's Car</Description>
		<InstalledDeviceType>XDrive</InstalledDeviceType>
		<InstalledDeviceId>49cd7ca3-7b72-4cd9-ad98-b93d39d611d0</InstalledDeviceId>
	</Vehicle>
	<Vehicle SystemType="XDrive" VehicleId="1186b7b8-2e4a-491e-84b5-4031f5d452fc">
		<Description>Fred's Truck</Description>
		<InstalledDeviceType>XDrive</InstalledDeviceType>
		<InstalledDeviceId>3d94c43b-3e2e-4d44-ac7a-a1ead9509443</InstalledDeviceId>
	</Vehicle>
</Vehicles>
<Drivers>
	<Driver SystemType="XDrive" DriverId="47914ad5-cb80-4e8c-bb43-a422c2568cde">
		<Name>Fred</Name>
		<DeviceDriverId>1536</DeviceDriverId>
	</Driver>
</Drivers>
</SearchResults>