SWS GetSMSMessageData Method
This method returns SMS message data for a specified SiteID, with available filters based on AccountID, RentalID and/or date range.
Parameters
Name | DataType | Is Required |
---|---|---|
SiteID | Long | Required |
Description | The site’s ID number. This can be found using the GetSiteList method. | |
AccountID | Long | Optional |
Description | The account’s ID number. This is returned when you use the CreateNewAccount method or can be retrieved with the SearchBy method. | |
RentalID | Long | Optional |
Description | The rental item’s ID number. This is returned when using the MakeReservation method or can be searched for using the SearchBymethod. | |
BeginDate | DateTime | Optional |
Description | The beginning date of the date range for which the SMS text message was scheduled. | |
EndDate | DateTime | Optional |
Description | The end date of the date range for which the SMS text message was scheduled. |
Returned Parameters
Name | DataType |
---|---|
Response | String |
Description | “SUCCESS” indicates that the query was successful, or “FAILURE” if not. The “FAILURE” message will include additional information about why the method failed. |
SMS_ID | Long |
Description | The unique ID number for the SMS message. |
SITE_ID | Long |
Description | The site’s ID number. |
RENTAL_ID | Long |
Description | The ID number of the rental. |
ACCT_ID | Long |
Description | The account’s ID number. |
SENT_DATE | String |
Description | The date the message was sent. |
SCHEDULED_DATE | String |
Description | The date the message is scheduled to be sent. |
SMS_TO | String |
Description | The TO address (phone number) that the message is being sent to. |
SMS_FROM | String |
Description | The FROM address (phone number) that the message is being sent from. |
SMS_BODY | String |
Description | The body of the message. |
SMS_STATUS | Integer |
Description | The numeric value of the delivery status of the message. Available values:
|
SMS_STATUS_MEANING | String |
Description | The textual value of the delivery status of the message. Available values:
|
SCHEDULE_ID | String |
Description | Not currently used. |
REGISTER_TYPE | Type |
Description | The indicator of what type of message was sent. This will be “4” to indicate “SMS Message” in all cases. |
INCLUDE_URL | Boolean |
Description | Indicates whether a payment URL is to be included with the message (“True”) or not (“False”). |
PAYMENT_URL | String |
Description | The sites payment URL that was sent in the message. |
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 create our objects. We’ll need the standard service object, a SiteID request object, an AccountRental request object and a GetSMSMessageData response object. We can define and create those objects like this:
// Create the request and response objects SWS.WSSoapClient service = new SWS.WSSoapClient(); SWS.SiteID_Request siteID_rqst = newSWS.SiteID_Request(); SWS.AccountRental_Request acctrental_rqst = new SWS.AccountRental_Request(); SWS.GetSMSMessageData_Response response = new SWS.GetSMSMessageData_Response();
Now we set up the parameters for our request.
// SiteID Request siteID_rqst.SiteID = 123456; // Account/Rental Request // these are optional parameters, you may set one, both or neither acctrental_rqst.AccountID = 234567; acctrental_rqst.RentalID = 345678;
Finally we can call the method and pass across the login object and the request objects to get our resultant dataset. 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.GetSMSMessageData(user_rqst, siteID_rqst, acctrental_rqst);}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.