API DOCUMENTATION Last Update: Apr 2022

Pre-Existing Report: All Customers

Generate a report with all the customers who have had transactions between two date ranges in the selected campaigns.

 

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
account_id greatwidgets Required
type reports Required
report customers_all Required
date_start 2010-01-01 Optional
date_end 2011-12-31 Optional
selected_campaigns 123456789012,21987654321 Optional
last 12345 Optional
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:

  • If the date_start, date_end, and selected_campaigns are not provided, any customer in the database will be returned, whether they have ever had a transaction or not.
  • If at least on campaign ID is provided, the customers returned will have had a transaction in the campaign(s)
  • Dates provided without any campaigns will be ignored. You need to provide at least one campaign in order to restrict customers to having had transactions within the date range provided.
  • The date_start and date_end must be provided in ISO 8601 format: YYYY-MM-DD, where YYYY is the year in four-digit format, MM is the month in 2-digit format, and DD is the day of the month in two digit format. This avoids all sorts of confusion as to which part of the date is represented in which position and allows for better and more natural date-based sorting.
  • Separate each selected_campaigns with a comma (no spaces!)
  • To get a list of any customer whose info has changed since last making the same request, make a note of the last ID returned when this call was made, and pass it using the last parameter. It will return all new customers or those with a change in their information. If no last parameter is passed, then all customers that fit the other parameters are returned. The first time making this call, use either 0 for all customers or any transaction ID to start from the datetime of that transaction. NOTE: When using this parameter, DO NOT pass the selected_campaigns parameter: They are incompatible.

 

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['account_id'] = 'greatwidgets';
  4. $data['type'] = 'reports';
  5. $data['report'] = 'customers_all';
  6. $data['date_start'] = '2010-01-01';
  7. $data['date_end'] = '2011-12-31';
  8. $data['selected_campaigns'] = '123456789012,210987654321';

 

Success XML Response (New / Updated User):

  1. <response status="success">
  2. <customer>
  3. <first_name>Jane</first_name>
  4. <last_name>Doe</last_name>
  5. <phone>555-5555</phone>
  6. <email>jdoe@email.com</email>
  7. <address1>123 Main St.</address1>
  8. <address2>Apt 3G</address2>
  9. <city>Anytown</city>
  10. <state>ND</state>
  11. <zip>12345</zip>
  12. <country>NZ</country>
  13. <custom1>She likes cheese!</custom1>
  14. <custom_date>1970-07-14</custom_date>
  15. <customer_username>jdoe123</customer_username>
  16. <customer_code>4137071924090694</customer_code>
  17. <card_number>11111111</card_number>
  18. </customer>
  19. <customer>
  20. ...
  21. </customer>
  22. </response>

 

Error XML Response:

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