Customer - Search
Search for a customer within each given field.
As opposed to Customer - Find, which finds a customer across all fields.
The data to be submitted to the API is composed of the following fields:
|
|
field |
|
Example |
|
Note |
|
|
|
user_id |
|
john1970 |
|
Required |
|
|
|
user_password |
|
1959caadac9b13dcb3 |
|
Required |
|
|
|
type |
|
customer_search |
|
Required |
|
|
|
exact_match |
|
sensitive or
insensitive |
|
Do not include for
partial matching. |
|
|
|
account_id |
|
greatwidgets |
|
Required |
|
|
|
card_number |
|
1234 |
|
Optional |
|
|
|
first_name |
|
John |
|
Optional |
|
|
|
last_name |
|
Doe |
|
Optional |
|
|
|
phone |
|
555-5555 |
|
Optional |
|
|
|
email |
|
jdoe@email.com |
|
Optional |
|
|
|
city |
|
Anytown |
|
Optional |
|
|
|
state |
|
ONT |
|
Optional |
|
|
|
postal_code |
|
55555 |
|
Optional |
|
|
|
custom_date |
|
1970-07-14 |
|
Optional |
|
|
|
custom_field |
|
baltimore |
|
Optional |
|
|
|
customer_username |
|
jdoe1970 |
|
Optional |
|
|
|
customer_password |
|
pa$$w0rd |
|
Optional |
|
|
|
customer_PIN |
|
1234 |
|
Optional |
|
|
|
custom_field_# |
|
Married |
|
Option |
|
|
|
include_balances |
|
Y |
|
Do not include
if not wanted. |
|
|
|
|
|
|
|
|
|
|
|
Output Format: |
|
|
|
output |
|
JSON or XML |
|
Optional. If not provided, defaults to XML |
|
|
|
callback |
|
someFunctionName |
|
Optional: JSONP format |
|
|
|
condensed |
|
yes |
|
Optional (No white space) Applies only to JSON(P) output |
|
|
|
|
|
|
|
|
|
Notes:
- At least one of the optional fields must be provided, otherwise, the whole customer list will be returned.
- If multiple matches result, then a list of those matching customers will be returned, with each customer's information.
- The custom_date field must be given in YYYY-MM-DD format
- Text-based matches are not case-sensitive.
- The search will return partial matches. For example: Searching for the first name "John" will return any record whose first name is also "Johnny". Searching for a partial card number will return all the customers whose card number includes the segment given.
- If the exact_match parameter is not included, the search will include partial matches and be case-insensitive (ex: searching for "smith" will also return "Smithson" or "O'Smithy".)
- If the exact_match parameter is included, using "sensitive" will match capitalization (ex: searching for "smith" will not return "Smith") and will not include partial matches.
- If the exact_match parameter is included, using "insensitive" will include any capitalization (ex: searching for "smith" will return "Smith") but will not include partial matches.
Example PHP Request:
If you are using PHP, the $data array would look like this:
- $data['user_id'] = 'john1970';
- $data['user_password'] = '1959caadac9b13dcb3';
- $data['type'] = 'customer_search';
- $data['account_id'] = 'greatwidgets';
- $data['last_name'] = 'Doe';
- $data['phone'] = 555-5555;
Success XML Response with single match:
- <response status="success">
- <customer>
- <code>89898989898989</code>
- <card_number>1212121212</card_number>
- <first_name>John</first_name>
- <last_name>Doe</last_name>
- <phone>555-5555</phone>
- <email>john@email.com</email>
- <street1>123 Main St.</street1>
- <street2>Apt 3G</street2>
- <city>Anytown</city>
- <state>ONT</state>
- <postal_code>55555</postal_code>
- <country>NZ</country>
- <custom_date>1970-07-14</custom_date>
- <custom_field>He Likes Cheese</custom_field>
- <customer_username>jdoe1970</customer_username>
- </customer>
- </response>
Success XML Response with multiple matches:
- <response status="success">
- <customer>
- <code>89898989898989</code>
- <card_number>1212121212</card_number>
- <first_name>John</first_name>
- <last_name>Doe</last_name>
- <phone>555-5555</phone>
- <email>john@email.com</email>
- <street1>123 Main St.</street1>
- <street2>Apt 3G</street2>
- <city>Anytown</city>
- <state>ONT</state>
- <postal_code>55555</postal_code>
- <country>NZ</country>
- <custom_date>1970-07-14</custom_date>
- <custom_field>He Likes Cheese</custom_field>
- <customer_username>jdoe1970</customer_username>
- </customer>
- <customer>
- <code>1234567890123456</code>
- <card_number>1313131313</card_number>
- <first_name>Jane</first_name>
- <last_name>Smith</last_name>
- <phone>555-6666</phone>
- <email>j.smith@workemail.com</email>
- <street1>321 Side St.</street1>
- <street2></street2>
- <city>Bigtown</city>
- <state>CA</state>
- <postal_code>55555</postal_code>
- <country></country>
- <custom_date>1966-07-28</custom_date>
- <custom_field></custom_field>
- <customer_username>janesmith222</customer_username>
- </customer>
- </response>
Success XML Response with "include_balances = Y":
- <response status="success">
- <customer>
- <code>89898989898989</code>
- <card_number>1212121212</card_number>
- <first_name>John</first_name>
- <last_name>Doe</last_name>
- <phone>555-5555</phone>
- <email>john@email.com</email>
- <street1>123 Main St.</street1>
- <street2>Apt 3G</street2>
- <city>Anytown</city>
- <state>ONT</state>
- <postal_code>55555</postal_code>
- <country>NZ</country>
- <custom_date>1970-07-14</custom_date>
- <custom_field>He Likes Cheese</custom_field>
- <customer_username>jdoe1970</customer_username>
- <campaigns>
- <campaign>
- <id>1234567890123456</id>
- <name>Widget Rewards</name>
- <type>points</type>
- <balance>1500</balance>
- <cumulative>4750</cumulative>
- <last_transaction>2011-12-31</last_transaction>
- </campaign>
- ...
- </campaigns>
- </customer>
- ...
- </response>
XML Response if no customer matches fields given:
- <response status="no_match">
- <message>Language-specific "No Customers Match Criteria"</message>
- </response>
Error XML Response:
- <response status="error">
- <error>Error message</error>
- </response>
|