SearchSalesReps

Description

The SearchSalesReps method retrieves SalesRep objects based off the filters.

Syntax

SalesRep[] SearchSalesReps(SecurityToken securityToken, string salesRepInternalId, string salesRepId, SearchFilter[] filters, int start, int limit, string sort)

Arguments

Type

Name

Req

Description

SecurityToken

securityToken

R

A unique token that is used to identify a merchant and authenticate the API request.

SearchFilter[]

filters

S

Filters SalesRep objects based on one or more field names, comparison operators, and field values. See supported search parameters below.

Note: If the SearchFilter object is empty, all SalesRep objects will be returned.

int

start

R

Index of the first object to return in the array.

Note: Must be ≥ 0.

int

limit

R

Maximum number of objects to return.

Note: Must be > 0.

string

sort

O

Sorts by field name.

Supported Sort Parameters
  • SalesRepId
  • SalesRepType
  • FirstName
  • LastName
  • NetDueInDays
  • CompanyName
  • Phone
  • CellPhone
  • Email
  • IsInactive

Return Value

TypeDescription
SalesRep[]On success, returns an array of SalesRep objects matching the search parameters. Otherwise, a fault is returned.

Supported Search/Sort Parameters
ParameterDescriptionExample of Use
SalesRepInternalIdFilters by the unique identifier for the sales representative.

<ebiz:SearchFilter> <ebiz:FieldName>SalesRepInternalId</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>**-7682-914***</ebiz:FieldValue> </ebiz:SearchFilter>

SalesRepIdFliters results by the sales rep ID.

<ebiz:SearchFilter> <ebiz:FieldName>SalesRepId</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>Sr-0002</ebiz:FieldValue> </ebiz:SearchFilter>

SalesRepTypeFilters by the sales rep type.

<ebiz:SearchFilter> <ebiz:FieldName>SalesRepType</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>Sales</ebiz:FieldValue> </ebiz:SearchFilter>

LinkedToInternalIdFilters by the internal unqiue identifier.

<ebiz:SearchFilter> <ebiz:FieldName>LinkedToInternalId</ebiz:FieldName> <ebiz:ComparisonOperator>ne</ebiz:ComparisonOperator> <ebiz:FieldValue>****2-4699-b******</ebiz:FieldValue> </ebiz:SearchFilter>

FirstNameFilters by the first name of the sales rep.

<ebiz:SearchFilter> <ebiz:FieldName>FirstName</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>Tim</ebiz:FieldValue> </ebiz:SearchFilter>

LastNameFilters by the last name of the sales rep.

<ebiz:SearchFilter> <ebiz:FieldName>LastName</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>Litton</ebiz:FieldValue> </ebiz:SearchFilter>

CompanyNameFilters by the company of the sales rep.

<ebiz:SearchFilter> <ebiz:FieldName>CompanyName</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>EBizCharge</ebiz:FieldValue> </ebiz:SearchFilter>

PhoneFilters by the phone number of the sales rep.

<ebiz:SearchFilter> <ebiz:FieldName>Phone</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>123-456-1789</ebiz:FieldValue> </ebiz:SearchFilter>

CellPhoneFilters by the cell phone number of the sales rep.

<ebiz:SearchFilter> <ebiz:FieldName>CellPhone</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>949-123-4567</ebiz:FieldValue> </ebiz:SearchFilter>

FaxFilters by the fax number of the sales rep.

<ebiz:SearchFilter> <ebiz:FieldName>Fax</ebiz:FieldName> <ebiz:ComparisonOperator>ne</ebiz:ComparisonOperator> <ebiz:FieldValue>testing</ebiz:FieldValue> </ebiz:SearchFilter>

EmailFilters by the email address of the sales rep.

<ebiz:SearchFilter> <ebiz:FieldName>Email</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>[[email protected]](mailto:[email protected])</ebiz:FieldValue> </ebiz:SearchFilter>

WebSiteFilters by the sales rep's website.

<ebiz:SearchFilter> <ebiz:FieldName>WebSite</ebiz:FieldName> <ebiz:ComparisonOperator>ne</ebiz:ComparisonOperator> <ebiz:FieldValue>[www.EBizCharge.com](http://www.EBizCharge.com)</ebiz:FieldValue> </ebiz:SearchFilter>

Address1Filters by the first address of the sales rep.

<ebiz:SearchFilter> <ebiz:FieldName>Address1</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>54 Sesame</ebiz:FieldValue> </ebiz:SearchFilter>

Address2Filters by the second address of the sales rep.

<ebiz:SearchFilter> <ebiz:FieldName>Address2</ebiz:FieldName> <ebiz:ComparisonOperator>ne</ebiz:ComparisonOperator> <ebiz:FieldValue>342</ebiz:FieldValue> </ebiz:SearchFilter>

Address3Filters by the third address of the sales rep.

<ebiz:SearchFilter> <ebiz:FieldName>Address3</ebiz:FieldName> <ebiz:ComparisonOperator>ne</ebiz:ComparisonOperator> <ebiz:FieldValue>123</ebiz:FieldValue> </ebiz:SearchFilter>

CityFilters by the sales rep's city.

<ebiz:SearchFilter> <ebiz:FieldName>City</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>Irvine</ebiz:FieldValue> </ebiz:SearchFilter>

StateFilters by the sales rep's state.

<ebiz:SearchFilter> <ebiz:FieldName>State</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>CA</ebiz:FieldValue> </ebiz:SearchFilter>

ZipCodeFilters by the sales rep's zipcode.

<ebiz:SearchFilter> <ebiz:FieldName>ZipCode</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>92644</ebiz:FieldValue> </ebiz:SearchFilter>

IsDefaultFilters by the sales rep's default address.

<ebiz:SearchFilter> <ebiz:FieldName>IsDefault</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>false</ebiz:FieldValue> </ebiz:SearchFilter>

AccountNumberFilters by the sales rep's account number.

<ebiz:SearchFilter> <ebiz:FieldName>AccountNumber</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>000027</ebiz:FieldValue> </ebiz:SearchFilter>

IsInactiveFilters by inactive sales reps.

<ebiz:SearchFilter> <ebiz:FieldName>IsInactive</ebiz:FieldName> <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator> <ebiz:FieldValue>false</ebiz:FieldValue> </ebiz:SearchFilter>


Example Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
   <soapenv:Header />
   <soapenv:Body>
      <ebiz:SearchSalesReps>
        <ebiz:securityToken>
           <ebiz:SecurityId>********-23f6-4466-a993-************</ebiz:SecurityId>
           <ebiz:UserId/>
           <ebiz:Password/>
        </ebiz:securityToken>
        <ebiz:filters>
           <!--Zero or more repetitions:-->
           <ebiz:SearchFilter>
              <ebiz:FieldName/>
              <ebiz:ComparisonOperator/>
              <ebiz:FieldValue/>
           </ebiz:SearchFilter>
        </ebiz:filters>
        <ebiz:start>0</ebiz:start>
        <ebiz:limit>10</ebiz:limit>
        <ebiz:sort/>	
      </ebiz:SearchSalesReps>
   </soapenv:Body>
</soapenv:Envelope>
public static void SearchSalesRep()
{
  //Create EBizCharge SOAP client
  IeBizService apiClient = new IeBizServiceClient();

  //Set up merchant authentication
  SecurityToken securityToken = new SecurityToken
    {
      SecurityId = "********-34ds-23dc-23sa-************",
      UserId = "****",  
      Password = "****"
      };


  string salesRepInternalId = "";
  string salesRepId = "";

  //Build search filters (each SearchFilter = field + operator + value)
  //You can specify one or more filters as needed
  SearchFilter[] filters = new SearchFilter[2];

  //Example 1: Find all reps with email equal to a value
  filters[0] = new SearchFilter();
  filters[0].FieldName = "Email";
  filters[0].ComparisonOperator = "eq";  // equals
  filters[0].FieldValue = "[email protected]";

  // Example 2: Find all reps with FirstName equal to "Tim"
  filters[1] = new SearchFilter();
  filters[1].FieldName = "FirstName";
  filters[1].ComparisonOperator = "eq";  // equals
  filters[1].FieldValue = "John";

  //Define pagination and sorting
  int start = 0;      // Start index (0 = first record)
  int limit = 10;     // Maximum number of records to return
  string sort = "LastName"; // Sort results by field (optional)

  //Call SearchSalesRep API
  SalesRep[] reps = apiClient.SearchSalesReps(
      securityToken,
      salesRepInternalId,
      salesRepId,
      filters,
      start,
      limit,
      sort
    );

  //Display results
  foreach (var rep in reps)
    {
      Console.WriteLine($"SalesRepInternalId:  {rep.SalesRepInternalId}");
      Console.WriteLine($"SalesRepId:          {rep.SalesRepId}");
      Console.WriteLine($"Type:                {rep.SalesRepType}");
      Console.WriteLine($"First Name:          {rep.FirstName}");
      Console.WriteLine($"Last Name:           {rep.LastName}");
      Console.WriteLine($"Email:               {rep.Email}");
      Console.WriteLine($"Company Name:        {rep.CompanyName}");
      Console.WriteLine($"Phone:               {rep.Phone}");
      Console.WriteLine($"Cell Phone:          {rep.CellPhone}");
      Console.WriteLine($"Account Number:      {rep.AccountNumber}");
      Console.WriteLine($"IsInactive:          {rep.IsInactive}");
    }
}
function searchSalesRep(): void{
  //Set up the client & configure the security token
  $client = new SoapClient('SOAP API Endpoint');
  $securityToken = array(
      'SecurityId' => '********-23dc-234f-34fc-************',
      'UserId' => 'merchant1',
      'Password' => 'merchant1'
    );

  // Create the filters array to filter the results
  $filters = array(
      array(
      'FieldName'          => 'Email',
      'ComparisonOperator' => 'ne', //Options are: gt (greater than), lt(less than), eq (equals),le (less than or equal), ge (greater than or equal), and ne (not equal).
      'FieldValue'         => '[email protected]'
    )
    );

  // Parameters for the SearchSalesRep request
  $params = array(
      'securityToken'       => $securityToken,
      'salesRepInternalId'  => '',    // Set this to a known salesRepInternalId to filter by
      'salesRepId'          => '',    // Set this to a known salesRepId to filter by
      'filters'             => $filters,  // The parameters to filter the results by
      'start'               => 0, 		// Start position, defaults to 0 (first payment found)
      'limit'               => 10, 		// Maximum number of payments to return in result. Default Max 1000.
      'sort'                => ''     // Field name to sort by
    );

  try {
      // Make the SOAP request
      $response = $client->SearchSalesReps($params);

      // Extract the result
      $result = $response->SearchSalesRepsResult->SalesRep;

      //Normalize results into an array (optional)
      $salesReps = is_array($result) ? $result : [$result];

      // Display the response
      echo "<pre>";
      print_r($salesReps);
      echo "</pre>";

      //loop through the results and print out the internal ID for each sales rep
      foreach ($salesReps as $rep) {
          $repId = $rep->SalesRepInternalId ?? 'N/A';
          echo "Sales Rep ID: $repId\n";
        }

    } catch (SoapFault $e) {
      // Handle SOAP errors
      echo "SOAP Error: " . $e->getMessage();
    }
}

Example Response

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <SearchSalesRepsResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <SearchSalesRepsResult>
            <SalesRep>
               <SalesRepInternalId>********-dbc8-4285-9519-1f53b5ca8bb6</SalesRepInternalId>
               <SalesRepId>Sr-0001</SalesRepId>
               <SalesRepType>Sales</SalesRepType>
               <LinkedToInternalId/>
               <FirstName>Tim</FirstName>
               <LastName>Litton</LastName>
               <CompanyName>A.Datum</CompanyName>
               <Phone>123-123-4567</Phone>
               <CellPhone>123-123-4567</CellPhone>
               <Fax/>
               <Email>[email protected]</Email>
               <WebSite/>
               <Address>
                  <Address1>123 Sesame</Address1>
                  <Address2/>
                  <Address3/>
                  <City>Irvine</City>
                  <State>CA</State>
                  <ZipCode>92644</ZipCode>
                  <IsDefault xsi:nil="true" />
               </Address>
               <AccountNumber>000027</AccountNumber>
               <IsInactive>false</IsInactive>
            </SalesRep>
            <SalesRep>
               <SalesRepInternalId>********-db6b-424b-8b7c-d38904ae1075</SalesRepInternalId>
               <SalesRepId>Sr-0002</SalesRepId>
               <SalesRepType>Sales</SalesRepType>
               <LinkedToInternalId />
               <FirstName>Tim</FirstName>
               <LastName>Litton</LastName>
               <CompanyName/>
               <Phone>123-123-1239</Phone>
               <CellPhone>123-123-1238</CellPhone>
               <Fax/>
               <Email>[email protected]</Email>
               <WebSite/>
               <Address>
                  <Address1>54 123</Address1>
                  <Address2/>
                  <Address3/>
                  <City>Irvine</City>
                  <State>CA</State>
                  <ZipCode>92644</ZipCode>
                  <IsDefault xsi:nil="true" />
               </Address>
               <AccountNumber>000027</AccountNumber>
               <IsInactive>false</IsInactive>
            </SalesRep>
         </SearchSalesRepsResult>
      </SearchSalesRepsResponse>
   </s:Body>
</s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <s:Fault>
         <faultcode>s:NotFound</faultcode>
         <faultstring xml:lang="en-US">Not Found</faultstring>
      </s:Fault>
   </s:Body>
</s:Envelope>