Update promotion

Use the updatePromotion method to alter the details of an existing promotion.

Request parameters

Parameter
Type / Description

sessionID

Required (string) Output of the Login method.

Required (object) Promotion object that you want to update.

Request sample

<?php
require ('PATH_TO_AUTH');

// Retrieve promotion details

$promotionCode = 'PROMOTION_CODE'; // code of the promotion that you want to update

$jsonRpcRequest = array (
  'jsonrpc' => '2.0',
  'id' => $i++,
  'method' => 'getPromotion',
  'params' => array($sessionID, $promotionCode)
);
//var_dump (callRPC((Object)$jsonRpcRequest, $host));

// Keep the promotion you want to update in $existingPromotion
$existingPromotion = callRPC((Object)$jsonRpcRequest, $host);
// Set the fields to update
$existingPromotion->Description = 'Updated description';

// Update the promotion
$jsonRpcRequest = array (
  'jsonrpc' => '2.0',
  'id' => $i++,
  'method' => 'updatePromotion',
  'params' => array($sessionID, $existingPromotion)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));

Response parameters

Parameter
Description

Updated promotion object.

Last updated

Was this helpful?