Search upsell campaigns
Overview
Use the searchUpsellCampaigns method via JSON-RPC API 6.0 to find and filter specific upsell campaigns.
Request Parameters
| Parameter Name | Type | Required/Optional | Description | 
|---|---|---|---|
| SessionId | String | Required | Unique 2Checkout session ID code. | 
| Name | String | String | Title of the campaign. | 
| PrimaryProductCodes | Array of Strings | Optional | Array of product codes used as primary products you want to filter by. | 
| PrimaryProductCode | String | Optional | Unique product code. | 
| RecommendedProductCodes | Array of Strings | Optional | Array of product codes used as recommended products you want to filter by. | 
| RecommendedProductCode | String | Optional | Unique product code. | 
| Statuses | Array of Strings | Optional | Array of statuses you want to filter by. | 
| Status | String | Optional | Status of the upsell campaign. Enum can be one of: 
 
 | 
| StartsAfter | String | Optional | Date in ‘Y-m-d’ format after which campaigns start. | 
| StartsBefore | String | Optional | Date in ‘Y-m-d’ before campaigns start. | 
| EndsAfter | String | Optional | Date in ‘Y-m-d’ after which campaigns are ending. | 
| EndsBefore | String | Optional | Date in ‘Y-m-d’ before campaigns end. | 
| EnabledForRenewals | Boolean | Optional | Filter campaigns enabled for renewal. | 
| CampaignCodes | Array of Strings | Optional | Array of campaign codes to filter by. | 
| CampaignCode | String | 
 | Unique code for an upsell campaign. | 
| Page | Integer | Optional | Page you want to retrieve. | 
| Limit | Integer | Optional | Maximum number of campaigns per page. | 
Request Example
<?php
 
require ('PATH_TO_AUTH');
 
$filters = new \stdClass();
$filters->Name = 'op_2';
$filters->PrimaryProductCodes = ['A59VUKFMA2', 'JN2GSQ184L'];
$filters->RecommendedProductCodes = ['XI2MNQ41MNH'];
$filters->Statuses = ['DISABLED', 'EXPIRED'];
$filters->StartsBefore = '2020-10-01';
$filters->StartsAfter = '2019-11-05';
$filters->EndsBefore = '2022-11-10';
$filters->EndsAfter = '2020-10-02';
//$filters->EnabledForRenewals = true;
//$filters->CampaignCodes = ['8050a1b7-338e-45bd-9936-17f98b01349e'];
$filters->Page = 1;
$filters->Limit = 10;
 
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'searchUpsellCampaigns';
$jsonRpcRequest->params = array($sessionID, $filters);
$jsonRpcRequest->id = $i++;
 
try {
    $result = callRPC($jsonRpcRequest, $host);
    echo "Campaigns: </br>",
    var_dump($result);
}
catch (SoapFault $e) {
    echo "Could not fetch upsell campaigns: " . $e->getMessage();
    exit;
}
Response
| Parameter Name | Type | Required/Optional | Description | 
|---|---|---|---|
| Page | Integer | Required | The Search page you are on. | 
| Limit | Integer | Required | Maximum number of campaigns per page. | 
| Upsells | Array of Strings | Required | Array of Upsell Campaigns. | 
| Object | Required | 
 | |
| UpsellsCount | Integer | Required | Total number of Upsells that fit your search criteria. | 
| PagesCount | Integer | Required | Total number of pages with Upsells that fit your criteria. |