Customer - Find
Finds a customer across all fields.
As opposed to Customer - Search which searches only inside each given 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_find |
|
Required |
|
|
|
account_id |
|
greatwidgets |
|
Required |
|
|
|
find_customer |
|
Amy Acker, 1234 Main St |
|
Required |
|
|
|
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:
- The search phrase is logic based:
- Spaces (" ") are considered logical "AND"
- Commas (",") are considered logical "OR"
- Spaces take precedence over commas (ANDs are evaluated before ORs)
- In the example above, the search phrase is equivalent to:
- ("Amy" AND "Acker") OR ("1234" AND "Main" AND "St")
- In english, this means: Find customer(s) which have either "Amy" and "Acker" -- or -- "1234" and "Main" and "St" in their record.
- If multiple matches result, then a list of those matching customers will be returned, with each customer's information.
- 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.
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_find';
- $data['account_id'] = 'greatwidgets';
- $data['find_customer'] = 'Amy Acker, 1234 Main St';
Success XML Response with single match:
- <response status="success">
- <customer>
- <code>89898989898989</code>
- <card_number>1212121212</card_number>
- <first_name>Amy</first_name>
- <last_name>Doe</last_name>
- <phone>555-5555</phone>
- <email>adoe@email.com</email>
- <street1>123 Acker 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>She Likes Cheese</custom_field>
- <customer_username>adoe1970</customer_username>
- </customer>
- </response>
Success XML Response with multiple matches:
- <response status="success">
- <customer>
- <code>1234567890123456</code>
- <card_number>1313131313</card_number>
- <first_name>John</first_name>
- <last_name>Doe</last_name>
- <phone>555-1234</phone>
- <email>john@email.com</email>
- <street1>434 Great St.</street1>
- <street2></street2>
- <city>Maintown</city>
- <state>ONT</state>
- <postal_code>55555</postal_code>
- <country>NZ</country>
- <custom_date>1966-07-28</custom_date>
- <custom_field></custom_field>
- <customer_username>jdoe1966</customer_username>
- </customer>
- <customer>
- <code>89898989898989</code>
- <card_number>1212121212</card_number>
- <first_name>Amy</first_name>
- <last_name>Doe</last_name>
- <phone>555-5555</phone>
- <email>adoe@email.com</email>
- <street1>123 Acker St.</street1>
- <street2>Apt 3G</street2>
- <city>Anytown</city>
- <state>ONT</state>
- <postal_code>M5A-5A5</postal_code>
- <country></country>
- <custom_date>1970-07-14</custom_date>
- <custom_field>She Likes Cheese</custom_field>
- <customer_username>adoe1970</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-1234</phone>
- <email>john@email.com</email>
- <street1>434 Great St.</street1>
- <street2></street2>
- <city>Maintown</city>
- <state>ONT</state>
- <postal_code>55555</postal_code>
- <country>NZ</country>
- <custom_date>1966-07-28</custom_date>
- <custom_field></custom_field>
- <customer_username>jdoe1966</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>
|