SWS GetContacts Method
Returns a rental contact from a rental contact ID or a collection of rental contacts for an account ID. If you retrieve the contacts by the account ID, do not use the CONTACT_TYPE 4 (Business Contact Record) as the primary contact in a rental. This will cause problems with the rental and may destabilize the account. The Business Contact Record is for Store use only.
Parameters
Name | DataType | Is Required |
---|---|---|
AcctID | 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. * Either the AcctID or ContactID is required. |
|
ContactID | Long | Optional* |
Description | The rental contact’s ID number. This is returned when using the CreateNewAccount or AddNewContact methods or you can search for it using the SearchBy method. * Either the AcctID or ContactID is required. |
|
SiteID | Long | Required |
Description | The site’s ID number. This can be found using the GetSiteList method. |
Returned Parameters
Name | DataType |
---|---|
ACCT_CONTACT_ADDRESSES | ACCT_CONTACT_ADDRESSES |
Description | A collection of address data associated with the rental contact. |
ACCT_CONTACT_PHONES | ACCT_CONTACT_PHONES |
Description | A collection of phone data related to the contact. |
ACCT_ID | Long |
Description | The account’s ID number. |
ACTIVE | Boolean |
Description | Indicates whether the contact is active (“True”) or not (“False”). |
CFLEX01 | String |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. |
CFLEX02 | String |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. |
CFLEX03 | String |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. |
CFLEX04 | String |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. |
CFLEX05 | String |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. |
CONTACT_ID | Long |
Description | The rental contact’s ID number. |
CONTACT_TYPE | Integer |
Description | A numeric value for the contact type. Available values:
|
CREATED | DateTime |
Description | The creation date and time of the contact. |
CREATED_BY | Long |
Description | The Store user’s ID that created the contact. |
DL_NUMBER | String |
Description | The rental contact’s driver’s license number. |
DL_STATE | String |
Description | The issuing state/province for the drivers license. |
DOB | String |
Description | The rental contact’s date of birth. The date format is based on your software coding parameters. |
ECOMM_CODE | String |
Description | No longer returned. |
String | |
Description | The rental contact’s email address. This is also used as the username if the site supports eStore/eCommerce. |
EMPLOYER | String |
Description | The rental contact’s employer. |
FIRST_NAME | String |
Description | The first name for the account/rental contact. |
KNOWN_AS | String |
Description | The alternate or nick name for the rental contact. |
LAST_NAME | String |
Description | The family/last name for the rental contact. |
SSN | String |
Description | The rental contact’s social security number. This field provides for limited viewing for privacy, but can be defined at any time. |
UPDATED | DateTime |
Description | The date and time the record was last updated. |
UPDATED_BY | Long |
Description | The Store user’s ID number that last updated the record. |
RentalID | Long |
Description | The rental item’s ID number. |
UnitID | Long |
Description | The unit’s ID number. This is maintained through rentals. |
UnitNumber | String |
Description | The unit’s number as assigned by the organization. This is not the UnitID. |
ContactID | Long |
Description | The rental contact’s ID number. |
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 GetContacts request object and a GetContacts response object. We can define and create those like this:
// Create request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.GetContacts_Request request = new SWS.GetContacts_Request();
SWS.GetContacts_Response response;
Here’s my sample code of the Request object.
// GetContacts Request
request.SiteID = 123456;
request.AcctID = 123456;
Finally we can call the method and pass across the login object and the request object to get our contacts. 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.GetContacts(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.