Comment on page

Vehicle

Handles Vehicle related requests with IMS web services.

Required Information

*Identity: In order to fetch driving summary data, the application must have a valid user (represented by the Identity). That user must be active.

Parameters

  • Expansion: A set of expansion to be used for Vehicle API.
The expansion includes userByRole, health, devices.

Concrete Example

Retrieve the list of all associated vehicles

To fetch the list of vehicles associated with the current user, use following snippet.
Swift
Kotlin
let service = VehicleService(identity: identity)
service.getAllVehicles(expansions: expansions,
then: { result in
guard !result.value.empty else {
// error
return
}
completionHandler(.success(result.value))
})
val service = VehicleService(identity: identity)
service.fetchVehicles(expansions) { result: Result<Content?>? ->
if (result?.value == null || result.throwable != null) {
// failure
} else {
// Success
val content = result.value
completionHandler(content)
}
})

Retrieve the vehicle by vehicle identity

Parameters

  • vehicleIdentity: An identity of the requested vehicle.
  • expansions: An expansion
  • plate: plate in string
To fetch the vehicle by vehicleIdentity associated with the current user, use following snippet.
Swift
Kotlin
let service = VehicleService(identity: identity)
service.getVehicleFor(vehicleIdentity: vehicleIdentity,
expansions: expansions,
plate: plate,
then: { result in
guard !result.value.empty else {
// error
return
}
completionHandler(.success(result.value))
})
val service = VehicleService(identity: identity)
service.fetchVehicle(vehicleId,
expansions) { result: Result<Content?>? ->
if (result?.value == null || result.throwable != null) {
// failure
} else {
// Success
val content = result.value
completionHandler(content)
}
})
Last modified 2mo ago