API DOCUMENTATION Last Update: Apr 2022

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:

  1. $data['user_id'] = 'john1970';
  2. $data['user_password'] = '1959caadac9b13dcb3';
  3. $data['type'] = 'customer_find';
  4. $data['account_id'] = 'greatwidgets';
  5. $data['find_customer'] = 'Amy Acker, 1234 Main St';

 

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>Amy</first_name>
  6. <last_name>Doe</last_name>
  7. <phone>555-5555</phone>
  8. <email>adoe@email.com</email>
  9. <street1>123 Acker 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>She Likes Cheese</custom_field>
  17. <customer_username>adoe1970</customer_username>
  18. </customer>
  19. </response>

 

Success XML Response with multiple matches:

  1. <response status="success">
  2. <customer>
  3. <code>1234567890123456</code>
  4. <card_number>1313131313</card_number>
  5. <first_name>John</first_name>
  6. <last_name>Doe</last_name>
  7. <phone>555-1234</phone>
  8. <email>john@email.com</email>
  9. <street1>434 Great St.</street1>
  10. <street2></street2>
  11. <city>Maintown</city>
  12. <state>ONT</state>
  13. <postal_code>55555</postal_code>
  14. <country>NZ</country>
  15. <custom_date>1966-07-28</custom_date>
  16. <custom_field></custom_field>
  17. <customer_username>jdoe1966</customer_username>
  18. </customer>
  19. <customer>
  20. <code>89898989898989</code>
  21. <card_number>1212121212</card_number>
  22. <first_name>Amy</first_name>
  23. <last_name>Doe</last_name>
  24. <phone>555-5555</phone>
  25. <email>adoe@email.com</email>
  26. <street1>123 Acker St.</street1>
  27. <street2>Apt 3G</street2>
  28. <city>Anytown</city>
  29. <state>ONT</state>
  30. <postal_code>M5A-5A5</postal_code>
  31. <country></country>
  32. <custom_date>1970-07-14</custom_date>
  33. <custom_field>She Likes Cheese</custom_field>
  34. <customer_username>adoe1970</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-1234</phone>
  8. <email>john@email.com</email>
  9. <street1>434 Great St.</street1>
  10. <street2></street2>
  11. <city>Maintown</city>
  12. <state>ONT</state>
  13. <postal_code>55555</postal_code>
  14. <country>NZ</country>
  15. <custom_date>1966-07-28</custom_date>
  16. <custom_field></custom_field>
  17. <customer_username>jdoe1966</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>