API DOCUMENTATION Last Update: Apr 2022

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:

  1. $data['user_id'] = 'john1970';
  2. $data['user_password'] = '1959caadac9b13dcb3';
  3. $data['type'] = 'customer_search';
  4. $data['account_id'] = 'greatwidgets';
  5. $data['last_name'] = 'Doe';
  6. $data['phone'] = 555-5555;

 

Success XML Response with single match:

  1. <response status="success">
  2. <customer>
  3. <code>89898989898989</code>
  4. <card_number>1212121212</card_number>
  5. <first_name>John</first_name>
  6. <last_name>Doe</last_name>
  7. <phone>555-5555</phone>
  8. <email>john@email.com</email>
  9. <street1>123 Main St.</street1>
  10. <street2>Apt 3G</street2>
  11. <city>Anytown</city>
  12. <state>ONT</state>
  13. <postal_code>55555</postal_code>
  14. <country>NZ</country>
  15. <custom_date>1970-07-14</custom_date>
  16. <custom_field>He Likes Cheese</custom_field>
  17. <customer_username>jdoe1970</customer_username>
  18. </customer>
  19. </response>

 

Success XML Response with multiple matches:

  1. <response status="success">
  2. <customer>
  3. <code>89898989898989</code>
  4. <card_number>1212121212</card_number>
  5. <first_name>John</first_name>
  6. <last_name>Doe</last_name>
  7. <phone>555-5555</phone>
  8. <email>john@email.com</email>
  9. <street1>123 Main St.</street1>
  10. <street2>Apt 3G</street2>
  11. <city>Anytown</city>
  12. <state>ONT</state>
  13. <postal_code>55555</postal_code>
  14. <country>NZ</country>
  15. <custom_date>1970-07-14</custom_date>
  16. <custom_field>He Likes Cheese</custom_field>
  17. <customer_username>jdoe1970</customer_username>
  18. </customer>
  19. <customer>
  20. <code>1234567890123456</code>
  21. <card_number>1313131313</card_number>
  22. <first_name>Jane</first_name>
  23. <last_name>Smith</last_name>
  24. <phone>555-6666</phone>
  25. <email>j.smith@workemail.com</email>
  26. <street1>321 Side St.</street1>
  27. <street2></street2>
  28. <city>Bigtown</city>
  29. <state>CA</state>
  30. <postal_code>55555</postal_code>
  31. <country></country>
  32. <custom_date>1966-07-28</custom_date>
  33. <custom_field></custom_field>
  34. <customer_username>janesmith222</customer_username>
  35. </customer>
  36. </response>

 

Success XML Response with "include_balances = Y":

  1. <response status="success">
  2. <customer>
  3. <code>89898989898989</code>
  4. <card_number>1212121212</card_number>
  5. <first_name>John</first_name>
  6. <last_name>Doe</last_name>
  7. <phone>555-5555</phone>
  8. <email>john@email.com</email>
  9. <street1>123 Main St.</street1>
  10. <street2>Apt 3G</street2>
  11. <city>Anytown</city>
  12. <state>ONT</state>
  13. <postal_code>55555</postal_code>
  14. <country>NZ</country>
  15. <custom_date>1970-07-14</custom_date>
  16. <custom_field>He Likes Cheese</custom_field>
  17. <customer_username>jdoe1970</customer_username>
  18. <campaigns>
  19. <campaign>
  20. <id>1234567890123456</id>
  21. <name>Widget Rewards</name>
  22. <type>points</type>
  23. <balance>1500</balance>
  24. <cumulative>4750</cumulative>
  25. <last_transaction>2011-12-31</last_transaction>
  26. </campaign>
  27. ...
  28. </campaigns>
  29. </customer>
  30. ...
  31. </response>

 

XML Response if no customer matches fields given:

  1. <response status="no_match">
  2. <message>Language-specific "No Customers Match Criteria"</message>
  3. </response>

 

Error XML Response:

  1. <response status="error">
  2. <error>Error message</error>
  3. </response>