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 | Description | |
|---|---|---|---|
securityToken | R | A unique token that is used to identify a merchant and authenticate the API request. | |
filters | S | Filters SalesRep objects based on one or more field names, comparison operators, and field values. See supported search parameters below. | |
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
|
Return Value
Supported Search/Sort Parameters
| Parameter | Description | Example of Use |
|---|---|---|
| SalesRepInternalId | Filters by the unique identifier for the sales representative. | |
| SalesRepId | Fliters results by the sales rep ID. | |
| SalesRepType | Filters by the sales rep type. | |
| LinkedToInternalId | Filters by the internal unqiue identifier. | |
| FirstName | Filters by the first name of the sales rep. | |
| LastName | Filters by the last name of the sales rep. | |
| CompanyName | Filters by the company of the sales rep. | |
| Phone | Filters by the phone number of the sales rep. | |
| CellPhone | Filters by the cell phone number of the sales rep. | |
| Fax | Filters by the fax number of the sales rep. | |
| Filters by the email address of the sales rep. | | |
| WebSite | Filters by the sales rep's website. | |
| Address1 | Filters by the first address of the sales rep. | |
| Address2 | Filters by the second address of the sales rep. | |
| Address3 | Filters by the third address of the sales rep. | |
| City | Filters by the sales rep's city. | |
| State | Filters by the sales rep's state. | |
| ZipCode | Filters by the sales rep's zipcode. | |
| IsDefault | Filters by the sales rep's default address. | |
| AccountNumber | Filters by the sales rep's account number. | |
| IsInactive | Filters by inactive sales reps. | |
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>Updated 6 months ago
