SWS GetSiteList Method
Retrieves a collection of site details based on filters entered in the parameters. This will only retrieve sites that are in the “Active” status. New sites may still be in “New/Pre-Production” or “Test/Training” which will be accessible through SWS, but will not show on this method’s response.
Parameters
Name | DataType | Is Required |
---|---|---|
ActiveOnly | Boolean | Optional |
Description | Filter to display only active sites. | |
AreaCode | String | Optional |
Description | Filter to display only sites in a specific area code. Max string length of 3. | |
CityArray | String | Optional |
Description | Filter to display only sites in a specific city. Max string length of 50. | |
OrgID | Long | Required |
Description | The organization’s ID number. | |
SiteID | Long | Optional |
Description | Filter to display only the sites whose ids are entered. This can be found using the GetSiteList method. | |
SiteName | String | Optional |
Description | Filter to display only the sites whose names appear in this list. Max string length of 250. | |
State | String | Optional |
Description | Filters for sites in a specific state/province. Because of the maximum string length we suggest using the two digit state/province code. Max string length of 10. | |
ZipArray | String | Optional |
Description | Filter for sites within a specific postal/ZIP code. |
Returned Parameters
Name | DataType |
---|---|
ADDRESS_LABEL | String |
Description | The description of the address location. |
AFFILIATE_ID | Long |
Description | (Depricated) The affiliation ID for the site and org affiliations. |
ALT_PHONE | String |
Description | The alternate phone number for the site. |
CFLEX01 | String |
Description | A custom field for additional site information created by the admin. |
CFLEX02 | String |
Description | A custom field for additional site information created by the admin. |
CFLEX03 | String |
Description | A custom field for additional site information created by the admin. |
CITY | String |
Description | The city field of the site address. |
COUNTRY | String |
Description | The country field of the site address. |
CURRENT_TIME | String |
Description | The current time when the information was retrieved. |
DISPLAY_NAME | String |
Description | The site’s name that the public sees. |
EMAIL_ADDRESS | String |
Description | The site’s main email address. |
FAX | String |
Description | The site’s fax number. |
LINE1 | String |
Description | Line one of the street address of the site. |
LINE2 | String |
Description | Line two of the street address of the site. |
LINE3 | String |
Description | Line three of the street address of the site. |
ONLINE_STATUS | String |
Description | Indicates whether the site is using eStore or not. Available values:
|
ORG_ID | Long |
Description | The organization’s ID number. |
PARENT_SITE | Long |
Description | The parent site’s ID number. This is used if the site has a satellite office. |
PHONE | String |
Description | The primary phone number for the site. |
POSTAL_CODE | String |
Description | The ZIP/postal code for the site’s address. |
PROPERTY_TYPE | Integer |
Description | The property type of the site. Available values:
|
SITE_ID | Long |
Description | The site’s ID number. |
SITE_NAME | String |
Description | The site’s name internally. |
SITE_NUMBER | String |
Description | The site’s number within the organization. This is not to be confused with the SITE_ID. |
SITE_STAUTS | Integer |
Description | The numeric value for the site’s status in the application. (Note: We are aware this is misspelled, but it can’t be updated for compatibility issues.) |
STATE | String |
Description | The state/province field of the site address. |
TIMEZONE_DISP_OFFSET | Integer |
Description | The number of time zones, plus or minus Mountain Time to display for the site on reports and in the application. |
TIMEZONE_OFFSET | Integer |
Description | The number of time zones, plus or minus Mountain Time, where the site is located. |
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 GetSiteList request object and a GetSiteList response object. We can define and create those like this:
// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.GetSiteList_Request request = new SWS.GetSiteList_Request();
SWS.GetSiteList_Response response;
Here’s my sample code of the Request object for a list of all sites in an organization. Other optional parameters can be applied to further narrow the results.
//GetSiteList Request for all sites in an org
request.OrgID = 123456;
Finally we can call the method and pass across the login object and the request object to get our site list. 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.GetSiteList(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.