API DOCUMENTATION Last Update: Apr 2022

Update Existing Campaign Promotion

Update an existing promotion in a Points-based campaign.

 

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 campaign_update Required
action promo Required
account_id greatwidgets Required
campaign_id 1234567890123456 Required
promo_id 35 Required
new_promo_operation x or + Optional
new_promo_amount 1.25 or 100 Optional
new_promo_description Pre-booking bonus Optional
new_promo_custom_id XFA-834 Optional
new_promo_start_date 2013-08-01 08:00:00 Optional
new_promo_end_date 2013-08-31 23:59:59 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:

  • The ability to updates promotions is based on the permissions of the user_id that is making the call.
  • At least one of the three parameters needs to be given (new_promo_operation, new_promo_amount, or new_promo_description.)
  • None of these three can be "blank".
  • If any of the parameters does not need to be updated, do not include it in the API call.
  • The new_promo_amount is based on the new_promo_operation chosen:
    • The "x" operation is a multiplier, so the new_promo_amount given will multiply the amount of points earned. For example:
      • A value of "1.25" is equivalent to adding 25% more points (100pts becomes 125pts)
      • A value of "0.5" is quivlaent to having the amount of points earned (100pts becomes 50pts)
    • The "+" operation adds the new_promo_amount to the points earned. For example:
      • A value of "100" will add 100 points to the amount of points earned.
      • A value of "-50" will subtract 50 points from the amount of points earned.
  • An error will be output if the new_promo_amount is blank or 0, and the new_promo_operation is "x". This will also happen If just one is given to the API but the other is already recorded as such. This is because "x" promotions cannot be zero otherwise this would trigger some "divide by zero" errors in certain instances. If you need to use a "zero" promotion, use the "+" operator. If you need the promotion to completely wipe the points earned with the purchase, use "0.001" for example.
  • Only one promotion can be updated at a time. Loop this call in your program to update multiple promotions at the same time.

     

    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'] = 'campaign_update';
    4. $data['action'] = 'promo';
    5. $data['account_id'] = 'greatwidgets';
    6. $data['campaign_id'] = '1234567890123456';
    7. $data['promo_id'] = 'greatwidgets';
    8. $data['new_promo_operation'] = '+';
    9. $data['new_promo_amount'] = '50';
    10. $data['new_promo_description'] = 'Pre-booking bonus (50pt)';

     

    Success XML Response:

    1. <response status="success">
    2. <promo status="updated">
    3. <id>14</id>
    4. </promo>
    5. </response>

    Note:

    • A successful result will return the promo_id of the promotion. This id can also be retrieved with the Campaign - List Promotions API call.

     

    Error XML Response:

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