Documentation of the CarRentalAgentService

CarRentalAgentService. Method 

Retrieves a set ofRates and Vehicles.

public RatesResponse (
   RatesRequest request
);

Parameters

RatesRequest
A RatesRequest containing the nessessary request data.

Return Value

A RatesResponse containing the requestedRates.

Remarks

Use this method to queryRates and Vehicles for specific car rental data. In detail, you will need base date and time information, such as DepartureDateTime and ArrivalDateTime. Moreover, you'll have to specify the CurrencyCode for the Currency of the returnedRates.

In addition to above mentioned data, you will have to specify the departure and arrival Locations or Regions. There's a major difference in using both entities.

If you're using Locations as departure and arrival, this method will return you the vehicles and rates for given departure location.

In contrast, if you're using Regions as departure and arrival, this method will return you the best choices of vehicles and rates based on the locations assigned to the given departure region. This "Regional Rate Query" - or "Best Offer" rate calculation - is probably one of the most exciting features of this Web Service. You can find an in-depth discussion of both calculation schemes in the Carena.

Note   

Depending on which calculation scheme you are using, the overall car rental process changes significantly. Consider this when designing your client implementation of this Web Service.

Apart from above "fundamental rate caclulation" data, you may additionally specify a VehicleTypeId as well as a VehicleAirConditionPreference and VehicleAutomaticGearPreference to narrow the results from this method.

Common Use Case Scenarios

Use Case Scenario Resolution Path
You have a departure and arrival location as well as departure and arrival date and time and want to find available vehicles / rates. Query rates with DepartureLocationId set to the id of the departure location and ArrivalLocationId set to the id of the arrival location.
You want to query the best rates for Miami, whereby the customer prefers vehicles having air condition. Query rates with DepartureRegionId and ArrivalRegionId set to the id of the region for Miami as well as setting VehicleAirConditionPreference set to Required.
Your customer arrives at Düsseldorf Airport and wants to rent a luxury-class car having automatic gear shifting and air condition.
  1. Query the associated region for specified airport using GetRegion with AirportCode set to the three letter IATA code of the airport (DUS).
  2. Query rates with DepartureRegionId and ArrivalRegionId set to the id of the previously obtained region. Moreover, set VehicleAirConditionPreference, VehicleAutomaticGearPreference to Required to met the feature preferences of customers. Finally, you'll have to set the VehicleTypeId to the id of the vehicle type corresponding to luxury-class vehicles to fit the customer's vehicle class preference.

List Of Errors Returned

Error Code Description
E_INTERNAL_SERVICE An internal service error occured during the process.
E_TICKET_TOKEN_INVALID The provided token is invalid.

This error occurs if:

  • The token is in invalid format.
  • The token is expired.
  • The token was not found.

E_RATE_NOT_FOUND Rate(s) or vehicle(s) for given reference data were not found.

This error occurs if:

  • No offers are currently available for the requested location / region and rental time.

E_DEPARTURE_DATE_TIME_INVALID The given departure date / time is invalid

This error occurs if:

  • The date / time is missing or incomplete.
  • The date / time is not given in required format.

E_ARRIVAL_DATE_TIME_INVALID The given arrival date / time is invalid

This error occurs if:

  • The date / time is missing or incomplete.
  • The date / time is not given in required format.

E_DEPARTURE_DATE_TIME_TOO_EARLY The given departure date / time is too early.

This error occurs if:

  • The date / time is in past relative to tomorrow.

E_ARRIVAL_DATE_TIME_TOO_EARLY The given arrival date / time is too early.

This error occurs if:

  • The date / time is in past relative to departure date / time.

E_RENTAL_DURATION_TOO_SHORT The rental duration is too short.

This error occurs if:

  • The departure and arrival date / time are equal.

E_RENTAL_DURATION_TOO_LONG The rental duration is too long.

This error occurs if:

  • The departure and arrival date / time specify a duration longer than 45 days.

E_REQUEST_AMBIGIOUS The request is ambigious.

This error occurs if:

  • Both DepartureRegionId and DepartureLocationId parameters are passed.
  • Both DepartureRegionId and ArrivalLocationId parameters are passed.
  • Both ArrivalRegionId and DepartureLocationId parameters are passed.
  • Both ArrivalRegionId and ArrivalLocationId parameters are passed.
  • Neither DepartureRegionId nor ArrivalRegionId parameters are passed.
  • Neither DepartureLocationId nor ArrivalLocationId parameters are passed.

E_REQUEST_INVALID The performed request is invalid or malformed.

List Of Warnings Returned

Warning Code Description
W_ADDITIONAL_RENTAL_DAY_APPLIED_DUE_24HOUR_RULE The rental duration is increased by one rental day.

This warning occurs if:

  • The time of arrival is greater than the time of departure, resulting in an overhang of minutes based on a 24hour-division of the rental duration. The remainder of this division is greater than 0, causing an increase of the rental duration by one rental day.

W_CURRENCY_NOT_SUPPORTED The requested currency code is not supported for rate query. Using default currency instead.

Example

Example: Query best rates for Munich, but only returning vehicles with air condition.

[C#]
RatesRequest rq = new RateRequest();
rq.Ticket = this.serviceTicket;
rq.Operation.Target = OperationTarget.Production;

// set rate data, we are setting the region id's of munich causing
// the web service to switch into "best offer" rate calulation mode.
rq.DepartureRegionId = rq.ArrivalRegionId = 595 // region id of munich

// set air condition preference
rq.VehicleAirConditionPreference = Preference.Required;

// set rental duration - note that we will get a warning of
// W_ADDITIONAL_RENTAL_DAY_APPLIED_DUE_24HOUR_RULE, because 24 hour
// division of the duration has a remainder > 0
rq.DepartureDateTime = "2005-06-01T10:00:00";
rq.ArrivalDateTime = "2005-06-03T18:00:00";

// finally set the currency to US dollars
rq.CurrencyCode = "USD";

// go for the rates
RatesResponse rs = this.service.GetRates(rq);

// display results
foreach (Rate rate in rs.Rate)
{
    Console.WriteLine("{0}\t{1}\t\t{2} {3}", rate.Vehicle.Code, rate.Vehicle.Name, rate.Value, rate.CurrencyCode);
    // this line is like "BB1    Opel Corsa        57 USD";
    
    Console.WriteLine("{0} is {1} and of type {2}", rate.Vehicle.Code, rate.RateServiceType.Name, rate.Vehicle.VehicleType.Name);
    // this line is like "BB1 is All Inclusive and of type Small Car";
    
    Console.WriteLine("{0}{1}{2} and {3} doors. Capacity of {4} passengers and {5} baggages.", 
        rate.Vehicle.Code, 
        rate.Vehicle.HasAirCondition ? " has air conditioning" : "",
        rate.Vehicle.HasAutomaticGear ? " has automatic gear shift" : "",
        rate.Vehicle.DoorCount,
        rate.Vehicle.PassengerCount,
        rate.Vehicle.BaggageCount
    );
    // this line is like "BB1 has airconditioning and 2 doors. Capacity of 2 passengers and 3 baggages.";
    
    Console.WriteLine("");
}

See Also

CarRentalAgentService Class | SunnyCars.Services.Osi.WsReservation Namespace