Home > API General, Rental/Reservation > SWS MakeMultipleReservations Method

SWS MakeMultipleReservations Method


Initiates multiple reservations/quotes into rental items. It returns all rental item IDs that were successfully processed as well as any ones that failed. The failed rental items will indicate the rental item ID that was part of the request object and an error message as to why.

Parameters

Name DataType Is Required
OrgID Long Required
Description The organization’s ID number.
Reservations MakeReservation_Request Required
Description The object containing the information required to make a reservation/rental.

Returned Parameters

Description

Name  Data Type
Succeeded:
QuoteID Long
Description The quotes ID number assigned at the time the quote record is created.
RentalID Long
Description The rental item’s ID number assigned at the time the quote record is created.
Failed:
UnitID Long
Description The unit’s ID number. This is maintained through rentals.
ErrorMessage String
Description The message explaining why the reservation failed.

Example

As with every method we need to pass in credentials. We do this with the LookupUser request object.

We’ll assume you’ve got a web reference, let’s name it SWS, in your Visual Studio project.  At this point we need to our objects.  We’ll need the standard service object, a MakeMultipleReservations request object and a MakeMultipleReservations response object. We will also need one or more RentalContact objects and one or more MakeReservation request objects.

// Create needed objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.MakeMultipleReservations_Request request = new SWS.MakeMultipleReservations_Request();
SWS.MakeMultipleReservations_Response response;

SWS.MakeReservation_Request resRequest = new SWS.MakeReservation_Request();
SWS.MakeReservation_Request resRequest2 = new SWS.MakeReservation_Request();
SWS.RentalContact conRequest = new SWS.RentalContact();

Here’s my sample code of the various objects. In this sample, two units are being reserved by the same person on the same account.

// Assign values
conRequest.ContactId = 123456;
conRequest.AddressId = 123456;
conRequest.PhoneId = 123456;
conRequest.PrimaryFlag = true;

resRequest.SiteID = 123456;
resRequest.AcctID = 123456;
resRequest.UnitID = 123456;
resRequest.Version = 5;
resRequest.QuoteType = SWS.Quote_Types.QuoteOnly;
resRequest.RentNow = false;
resRequest.Price = 50m;
resRequest.Contacts = new SWS.RentalContact[] { conRequest };

resRequest2.SiteID = 123456;
resRequest2.AcctID = 123456;
resRequest2.UnitID = 456789;
resRequest2.Version = 12;
resRequest2.QuoteType = SWS.Quote_Types.QuoteOnly;
resRequest2.RentNow = false;
resRequest2.Price = 60m;
resRequest2.Contacts = new SWS.RentalContact[] { conRequest };

request.OrgID = 123456;
request.Reservations = new SWS.MakeReservation_Request[] 
                      { resRequest, resRequest2 } ;

Finally we can call the method and pass across the login object and the request object to make our multiple reservations. It’s a good idea to do this in a Try Catch block.

// Call the method that will load the response object
try
{
  response = service.MakeMultipleReservations(user_request, request);
}
catch (Exception ex)
{
  MessageBox.Show(ex.Message);
}

Note that if something goes wrong the service will respond with an exception. You’ll want to take a look at that message returned in that exception so it can be debugged.

For a full list of methods see SWS Methods.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: