API DOCUMENTATION Last Update: Apr 2022

Campaigns List

Returns a list of the campaigns for an account.

 

The data to be submitted to the API is composed of the following fields:

 

  field   Example   Note
API 1.5 Required
user_id john1970 Required
user_api_key 1959caadac9b13dcb3 Required
account_id greatwidgets Required
type campaigns_list Required
type_restrict points,
giftcard,
events,
earned,
buyx
Optional
searchField

campaign_name

campaign_type

campaign_id

create_date

Optional
searchOper

eq (equal)

ne (not equal)

bw (begins with)

bn (does not begin with)

ew (ends with)

en (does not end with)

cn (contains)

nc (does not contain)

nu (is null/empty)

nn (is not null/empty)

in (is in - comma-separated list)

ni (is not in - comma-separated list)

Optional
searchValue Employee Optional
sortField

campaign_name

campaign_type

campaign_id

create_date

Optional
sortOrder DESC or

ASC

Optional
offset 0 Optional
length 10 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:

  • When using this call, the list of campaigns returned is based on the permissions of the user_id that is making the call.
  • The type_restrict parameter is optional, and can be combined with the searchField. If it's not given, all campaign types are returned. If you want multiple campaign types, list each type separated by a comma, which makes it slightly different than achieving the same thing using searchField=campaign_type, which is restricted to a single campaign type.

 

Example PHP Request:

If you are using PHP, the $data array would look like this:

  1. $data['API'] = '1.5';
  2. $data['user_id'] = 'john1970';
  3. $data['user_api_key'] = '1959caadac9b13dcb3';
  4. $data['type'] = 'campaigns_list';
  5. $data['account_id'] = 'greatwidgets';

 

Success XML Response:

  1. <response status="success">
  2. <campaign>
  3. <id>1234567890123456</id>
  4. <name>Widget Rewards</name>
  5. <type>points</type>
  6. <points_ratio>5</points_ratio>
  7. <reward_ratio>15</reward_ratio>
  8. <currency>EUR</currency>
  9. <glyph></glyph>
  10. </campaign>
  11. <campaign>
  12. <id>2345678901234567</id>
  13. <name>Sales Bucks</name>
  14. <type>earned</type>
  15. <earned_per_event>4.95</earned_per_event>
  16. <currency>EUR</currency>
  17. <glyph></glyph>
  18. </campaign>
  19. <campaign>
  20. <id>3456789012345678</id>
  21. <name>Frequent Shopper Rewards</name>
  22. <type>buyx</type>
  23. <item>
  24. <id>45678</id>
  25. <description>Coffees and Teas</description>
  26. <earn_ratio>10</earn_ratio>
  27. ...
  28. </item>
  29. </campaign>
  30. ...
  31. </response>

Notes:
There are 5 campaign types:

  • points (Points-based campaigns)
  • giftcard (Currency-based campaigns)
  • events (Event-based campaigns
  • earned (Currency earned per event campaigns)
  • buyx (Buy X Get 1 Free type campaigns)

Gift Card and events-based campaigns do not have ratios to report.

 

Example PHP request to list ONLY Gift Cards and Points campaigns:

If you are using PHP, the $data array would look like this:

  1. $data['API'] = '1.5';
  2. $data['user_id'] = 'john1970';
  3. $data['user_api_key'] = '1959caadac9b13dcb3';
  4. $data['type'] = 'campaigns_list';
  5. $data['account_id'] = 'greatwidgets';
  6. $data['type_restrict'] = 'giftcard, points';

 

Success XML Response:

  1. <response status="success">
  2. <campaign>
  3. <id>2345678901234567</id>
  4. <name>My Stored Value Card</name>
  5. <type>giftcard</type>
  6. </campaign>
  7. <campaign>
  8. <id>1234567890123456</id>
  9. <name>Widget Rewards</name>
  10. <type>points</type>
  11. <points_ratio>5</points_ratio>
  12. <reward_ratio>15</reward_ratio>
  13. </campaign>
  14. ...
  15. </response>

Error XML Response:

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