Home > API General, Site Administration > SWS UpdateUnitStatusExpanded Method

SWS UpdateUnitStatusExpanded Method

Allows the user to change the status of a rental item if the current status is not “Reserved” or “Rented”. Multiple rental items can be individually processed with a new status. It is an expanded function to the UpdateUnitStatus SWS method because it allows for change to occur on the rental item status to another possible status rather than just available or hold.


Name DataType Is Required
OrgID Long Required
Description The organization’s ID number.
SiteID Long Required
Description The site’s ID number. This can be found using the GetSiteList method.
UnitID Long Required
Description The unit’s ID number. This is returned when you use any of the GetSiteUnitData calls and is maintained through rentals.
UnitStatus unitStsVals Required
Description The available statuses to which the unit can be changed. The unit cannot currently be “Reserved” or “Rented”.
Available values:

  • VIRTUAL_LINKED_UNITS (Not currently used.)
UnitVersion Decimal Required
Description The unit’s version number which serves to prevent duplicate use of the unit.

Returned Parameters

Name DataType
ErrorMessage String
Description A message about any problem that occurred during the process, including details to locate errant code.
NewUnitVersion Decimal
Description The unit’s new version number which serves to prevent duplicate use of the unit.
Succeeded Boolean
Description Indicates if the unit was updated successfully (“True”) of if the update failed (“False”).
UnitID Long
Description The unit’s ID number. This is maintained through rentals.


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

We will assume you have a web reference, let us name it SWS, in your Visual Studio project. At this point we need to define our objects.  We will need the standard service object, an UpdateUnitStatusExpanded request object, and an UpdateUnitStatusExpanded response object. We will also need an UpdateUnitStatusExpanded_RequestData object to pass to the request. We can define and create those like this:

// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.UpdateUnitStatusExpanded_Request request 
                       = new SWS.UpdateUnitStatusExpanded_Request();
SWS.UpdateUnitStatusExpanded_Response response;

SWS.UpdateUnitStatusExpanded_RequestData reqUnitData 
                       = new SWS.UpdateUnitStatusExpanded_RequestData();

Here is a sample code of the request object:

// UpdateUnitStatusExpanded Request
 With objReq
reqUnitData.OrgID = 123456;
reqUnitData.SiteID = 123456;
reqUnitData.UnitID = 123456;
reqUnitData.UnitVersion = 12;
reqUnitData.UnitStatus = SWS.unitStsVals.AVAILABLE_HOLD;

request.UnitStatusUpdateData[0] = reqUnitData;

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

// Call the method that will load the response object
  response = service.UpdateUnitStatusExpanded(user_request, request);
catch (Exception ex)

Note that if something goes wrong the service will respond with an exception. You will want to capture the message in the 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 )

Facebook photo

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

Connecting to %s