Home > API General, Rates/Pricing > SWS2 UpdatePushStreetRate Method

SWS2 UpdatePushStreetRate Method


Allows you to do a bulk update on the street or push rates for a group of units at a site. The method allows for a collection of the PushStreetRateInfo object to be passed in. The return object is a comma delimited string of “Succeeded” or “Failed”. Due to a 4,000 character limitation, the unit_ids in the array are parsed into groupings less than 4,000 characters and each group returns a result of “Succeeded” or “Failed” for the batch appended to the return object. Each PushStreetRateInfo object’s array is parsed into their own groups and appended to the return object for the entire method.

Parameters

Name Data Type Is Required
NewRate Decimal Required
Description The dollar amount to which the rate will change.
RateType Integer Required
Description Indicates if it is the street rate (“1”) or the push rate (“2”) that is being updated.
UnitIDs Long (or an array of long) Required
Description The unit’s ID number for which the rate is being updated. This is returned when you use any of the GetSiteUnitData
calls and is maintained through rentals.
SiteID Long Required
Description The site’s ID number. This can be found using the GetSiteList method.

Returned Parameters

Name Data Type
UnitIDs Long (or an array of long)
Description The list of unit IDs where the street or push rate was updated.

Example

We’ll assume you’ve got a web reference, let’s name it Store, in your Visual Studio project. At this point we need to reference our objects. We’ll need the standard service object, a UpdatePushStreetRate_Request request object and a PushStreetRateInfo object. We can define and create those like this:

// Create a request and response objects
StoreServiceClient client = new StoreServiceClient();
UpdatePushStreetRate_Request request = new UpdatePushStreetRate_Request();
PushStreetRateInfo rateInfo = new PushStreetRateInfo();

As with every method we need to pass in credentials. We also set up the parameters for our request.

client.ChannelFactory.Credentials.UserName.UserName = "user";
client.ChannelFactory.Credentials.UserName.Password = "pass";
client.ChannelFactory.Credentials.SupportInteractive = true;

rateInfo.UnitIDs = new long[] { 123456, 456789 };
rateInfo.RateType = 1;
rateInfo.NewRate = 50m;

request.SiteID = 123456;
request.PushStreetRateInfo = new PushStreetRateInfo[] { rateInfo };

Finally we can call the method and pass across the login object and the request object to update the rate/s. It’s a good idea to do this in a Try Catch block.

try
{
    // Call the method that will load the response object
    UpdatePushStreetRate_Response resp;
    resp = client.UpdatePushStreetRate(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 SWS2 Methods.

Categories: API General, Rates/Pricing
  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: