Jump to content

GetLists()

Retrieves a simple list of all contact lists in the account, optionally filtered by date created. This method returns a maximum of 200 rows at a time, for performance reasons.  See below for more information.

To retrieve more detailed information about a given list, use the GetListDetails method.

Parameters

ApiKey (Required)
    Your application authentication key. Click here to find out more.
StartIndex (Optional)
    The zero-based index offset at which to start listing the results. If left blank, the list will start at index 0 (i.e. the beginning).
StartDate (Optional)
    The date from which to filter results, using the format YYYY-MM-DD. If not provided, the method will search from the beginning of time.
EndDate (Optional)
    The date to which results should be filtered, using the format YYYY-MM-DD. If not provided, the method will include all lists created through today.

Return Value

On success, this method returns the following information:

  • List ID - the ID number of the list
  • Name - the name of the list

On failure, a SOAP fault exception is thrown with one of the fault codes below.

Usage Notes

none

Fault Codes

100 - Invalid API Key
    The API key is not valid or expired

SOAP Sample Request


    
    
        
            
                STRING
                INT
                STRING
                STRING
            
        
    

SOAP Sample Response


    
    
        
            
                INT
                
                    
                        INT
                        STRING
                    
                     ... 
                
            
        
    

Code Sample - PHP

// Import the eConnect Email API Toolkit
require_once('eConnectEmail_API_Toolkit.php');

$eConnectEmailApi = TheKeyMakerClient('YOUR_API_KEY');

$result = $eConnectEmailApi->GetLists(START_INDEX, 'START_DATE', 'END_DATE');

// Show the results
print 'Response: <pre>';
print_r($result);
print '</pre>';

Code Sample - ASP.NET C#

            TheKeyMaker_v20 api = new TheKeyMaker_v20();
            // Set up input parameters
            DateRangeParams glParams = new DateRangeParams();
            glParams.ApiKey = txtApiKey.Text;
            glParams.StartIndex = (txtGLStartIndex.Text.Trim() != "") ? int.Parse(txtGLStartIndex.Text) : 0;
            glParams.StartDate = txtGLStartDate.Text;
            glParams.EndDate = txtGLEndDate.Text;

            // Invoke method and store result
            ReturnLists campaigns = api.GetLists(glParams);

            // Display results
            lblResult.Text = FormatValue("Total # of Lists", campaigns.ListCount.ToString());
            if (campaigns.Lists != null)
            {
                lblResult.Text += "

Lists and the List ID(s) used by each:

    "; foreach (ListResult list in campaigns.Lists) { lblResult.Text += "
  • " + list.Name + " (ID " + list.ListID.ToString() + ")"; } lblResult.Text += "
"; } else lblResult.Text += "

No lists exist that match the specified criteria.

";