|
BuyX Campaign Items List
Returns a list of the items that can be accumulated for the given "Buy X Get One Free" campaign.
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 |
|
buyx_items_list |
|
Required |
|
|
|
campaign_id |
|
1111222233334444 |
|
Required |
|
|
|
|
|
|
|
|
|
|
|
searchField |
|
service_product or
reward_id
buy_amount
|
|
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 |
|
Coffee (service_product)or 51 (reward_id) or 10 (buy_amount) |
|
Optional |
|
|
|
|
|
|
|
|
|
|
|
sortField |
|
service_product or
reward_id
buy_amount
|
|
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 'account_id' MUST be the unique Owner ID that is found in the "Edit Account Information" page reached from the main page / control panel.
- The 'campaign_id' MUST be the unique Campaign ID that is found in the "Edit Campaign" page reached from the main page / control panel listing of campaigns.
- The searchField and sortField are:
- service_product - For the text description of the items accumulated
- reward_id - the Reward ID of the item.
- buy_amount - The amount of times the item has to be purchased to earn a free one.
Example PHP Request:
If you are using PHP, the $data array would look like this:
- $data['API'] = '1.5';
- $data['user_id'] = 'john1970';
- $data['user_api_key'] = '1959caadac9b13dcb3';
- $data['type'] = 'buyx_items_list';
- $data['account_id'] = 'greatwidgets';
- $data['campaign_id'] = '1111222233334444';
- $data['searchField'] = 'service_product';
- $data['searchValue'] = 'Coffee';
- $data['searchOper'] = 'cn';
- $data['sortField'] = 'service_product';
- $data['sortOrder'] = 'ASC';
- $data['offset'] = '30';
- $data['length'] = '10';
Success XML Response:
- <response status="success">
- <campaign>
- <id>1111222233334444</id>
- <name>Store Rewards!</name>
- </campaign>
- <pagination>
- <total>56</total>
- <offset>30</offset>
- <pagination>
- <buyx_items>
- <item>
- <id>345</id>
- <description>Coffees and Lattes</description>
- <quantity>8</quantity>
- </item>
- <item>
- <id>494</id>
- <description>Blended Drinks</description>
- <quantity>12</quantity>
- <reward_id>12398749834</reward_id>
- </item>
- ...
- </buyx_items>
- </response>
Notes:
- The "quantity" is the amount of the item needed to be purchased before the next one is free – Not a customer's balance.
- When identifying the item (or "reward") to the API, you MUST use the <id> that is returned in the XML construct, NOT the <reward_id> which corresponds to the optional item_identifier field.
Error XML Response:
- <response status="error">
- <error>Error message</error>
- </response>
|
|