로그인

저희 지원센터에 오신 것을 환영합니다

광고 진행을 위한 작업과 라이브를 위해 도움을 드리겠습니다.

저희 지원센터에 오신 것을 환영합니다. 광고 진행을 위한 작업과 라이브를 위해 도움을 드리겠습니다.

Criteo API를 시작하려면 어떻게 해야 합니까?

프로그래머가 아니라면 이 부분을 직접 설정하려 하지 마십시오. Criteo API를 처음 접하는 경우, 웹 API를 사용하려면 프로그래머의 전문 지식이 필요합니다.

설정 과정 전반을 안내해 줄 수 있는 기술 지원 팀에 연락하십시오.  

 

Criteo API

아래에 Criteo API 코드 예제가 나와 있습니다. 소스 파일을 다운로드하려면 여기를 이용하십시오. 

<

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CPOP_API_Test.CriteoServiceReferencev201305;

namespace CPOP_API_Test
{
class Program
{
static void Main(string[] args)
{
CSharpAPIExample api = new CSharpAPIExample("foo_api", "foo_api0", "foo-criteoapi-01", 123456789);
api.Login();
string reportURL = api.GetStatisticsReportURL(new DateTime(2014, 1, 23), new DateTime(2014, 1, 24));
string transIDURL = api.GetTransactionIDReportURL(new DateTime(2014, 1, 23), new DateTime(2014, 1, 24));
campaign[] activeCampaigns = api.GetAllActiveCampaigns();
category[] categories = api.GetAllCategories();
}
}

class CSharpAPIExample
{
private CriteoAdvertiserAPIv201305 c;

public CSharpAPIExample() { }

public CSharpAPIExample(string username, string password, string source, long token)
{
this.username = username;
this.password = password;
this.source = source;
this.token = token;
}

private string username { get; set; }
private string password { get; set; }
private string source { get; set; }
private long token { get; set; }

public void Login()
{
c = new CriteoAdvertiserAPIv201305();
long authToken = c.clientLogin(username, password, source);

// 앱과 함께 authToken 사용
apiHeader header = new apiHeader();
header.appToken = token;
header.authToken = authToken;
header.clientVersion = "1.0";
c.apiHeaderValue = header;
}

public string GetStatisticsReportURL(DateTime start, DateTime end)
{
ReportJob job = new ReportJob();
job.startDate = start.ToString("yyyy-MM-dd");
job.endDate = end.ToString("yyyy-MM-dd");
job.aggregationType = AggregationType.Daily;
job.reportType = ReportType.Campaign;
job.selectedColumns = new ReportColumn[] {
ReportColumn.clicks,
ReportColumn.convRate,
ReportColumn.cost,
ReportColumn.costOfSale,
ReportColumn.ctr,
ReportColumn.impressions,
ReportColumn.orderValue,
ReportColumn.sales,
};

ReportJobResponse response = c.scheduleReportJob(job);
return getJobResponse(response);
}

public string GetTransactionIDReportURL(DateTime start, DateTime end)
{
TransactionReportJob j = new TransactionReportJob();
j.selectedColumns = new TransactionReportColumn[] {
TransactionReportColumn.clickDateTime,
TransactionReportColumn.displayDateTime,
TransactionReportColumn.duplicateStatus,
TransactionReportColumn.orderValue
};
j.startDate = start.ToString("yyyy-MM-dd");
j.endDate = end.ToString("yyyy-MM-dd");

TransactionReportJobResponse tResponse = c.scheduleTransactionReportJob(j);
return getJobResponse(tResponse);
}

private string getJobResponse(JobResponse response)
{
while (true)
{
JobStatus status = c.getJobStatus(response.jobID);
if (status == JobStatus.Completed) break;
else if (status == JobStatus.Failed)
throw new Exception(string.Format("{0} - ({1}) {2}", response.jobStatus, response.apiException.errorCode, response.apiException.message));
}
return c.getReportDownloadUrl(response.jobID);
}

// 모든 활성 캠페인 조회
public campaign[] GetAllActiveCampaigns()
{
CampaignSelectors selector = new CampaignSelectors();
selector.campaignStatus = new CampaignStatus[] { CampaignStatus.RUNNING };
return c.getCampaigns(selector);
}

// 모든 범주 조회
public category[] GetAllCategories()
{
CategorySelectors selector = new CategorySelectors();
return c.getCategories(selector);
}
}
}

 

Criteo 광고주 API

아래에 Criteo 광고주 API 코드의 예제가 나와 있습니다. 소스 파일을 여기에서 다운로드할 수도 있습니다. 

<

<?php
class clientLogin {
public $username; // string
public $password; // string
public $source; // string
}

class clientLoginResponse {
public $clientLoginResult; // long
}

class partnerLogin {
public $appToken; // long
public $username; // string
public $password; // string
public $source; // string
}

class partnerLoginResponse {
public $partnerLoginResult; // long
}

class getAccount {
}

class getAccountResponse {
public $getAccountResult; // AdvertiserAccount
}

class AdvertiserAccount {
public $advertiserName; // string
public $email; // string
public $currency; // string
public $timezone; // string
public $country; // string
}

class apiHeader {
public $authToken; // long
public $appToken; // long
public $clientVersion; // string
}

class getCampaigns {
public $campaignSelector; // CampaignSelectors
}

class CampaignSelectors {
public $campaignIDs; // ArrayOfInt
public $budgetIDs; // ArrayOfInt
public $campaignStatus; // ArrayOfCampaignStatus
public $biddingStrategy; // ArrayOfBiddingStrategy
}

class CampaignStatus {
const RUNNING = 'RUNNING';
const DEAD = 'DEAD';
const NOT_RUNNING = 'NOT_RUNNING';
}

class biddingStrategy {
const Cpm = 'Cpm';
const Cpc = 'Cpc';
const Cpa = 'Cpa';
const Cpo = 'Cpo';
}

class getCampaignsResponse {
public $getCampaignsResult; // ArrayOfCampaign
}

class campaign {
public $campaignID; // int
public $campaignName; // string
public $endDate; // string
public $campaignBid; // bidInformation
public $budgetID; // int
public $remainingDays; // int
public $status; // CampaignStatus
public $categoryBids; // ArrayOfCategoryBid
}

class bidInformation {
public $biddingStrategy; // biddingStrategy
public $cpcBid; // CPCBid
public $cpaBid; // CPABid
}

class CPCBid {
public $cpc; // double
}

class CPABid {
public $postClick; // int
public $postView; // int
public $commission; // double
public $percent; // double
}

class categoryBid {
public $campaignCategoryUID; // int
public $campaignID; // int
public $categoryID; // int
public $selected; // boolean
public $bidInformation; // bidInformation
}

class mutateCampaigns {
public $listOfCampaignMutates; // ArrayOfCampaignMutate
}

class campaignMutate {
public $campaign; // campaign
}

class mutate {
public $operationMutate; // OperationMutate
}

class OperationMutate {
const ADD = 'ADD';
const RESET = 'RESET';
const SET = 'SET';
}

class mutateCampaignsResponse {
public $listOfJobResponse; // ArrayOfCampaignMutateJobResponse
}

class campaignMutateJobResponse {
public $campaignMutate; // campaignMutate
}

class JobResponse {
public $jobID; // long
public $jobStatus; // JobStatus
public $apiException; // ApiExceptionData
}

class JobStatus {
const Pending = 'Pending';
const InProgress = 'InProgress';
const Completed = 'Completed';
const Failed = 'Failed';
}

class ApiExceptionData {
public $errorCode; // ApiExceptionErrorCode
public $errors; // ArrayOfApiError
public $message; // string
public $trigger; // string
}

class ApiExceptionErrorCode {
const NoError = 'NoError';
const BadAuthentification = 'BadAuthentification';
const AuthTokenExpired = 'AuthTokenExpired';
const InvalidAppTokenAuthToken = 'InvalidAppTokenAuthToken';
const AuthentificationNotExist = 'AuthentificationNotExist';
const UserAccessDisabled = 'UserAccessDisabled';
const UserAccessNotAllowed = 'UserAccessNotAllowed';
const MissingData = 'MissingData';
const OperationNotSupported = 'OperationNotSupported';
const InvalidID = 'InvalidID';
const AccessToThisJobNotAllowed = 'AccessToThisJobNotAllowed';
const InvalidFieldValue = 'InvalidFieldValue';
const UnexpectedError = 'UnexpectedError';
const AppTokenNotSupportedForPartnerLogin = 'AppTokenNotSupportedForPartnerLogin';
}

class apiError {
public $code; // ApiErrorCode
public $detail; // string
public $field; // string
public $index; // int
public $isExemptable; // boolean
public $textIndex; // int
public $textLength; // int
public $trigger; // string
}

class ApiErrorCode {
const NoError = 'NoError';
const MissingMutateStructure = 'MissingMutateStructure';
const MissingMutateObject = 'MissingMutateObject';
const MissingJobReportStructure = 'MissingJobReportStructure';
const UnexpectedError = 'UnexpectedError';
}

class getCategories {
public $categorySelector; // CategorySelectors
}

class CategorySelectors {
public $categoryIDs; // ArrayOfInt
public $selected; // boolean
}

class getCategoriesResponse {
public $getCategoriesResult; // ArrayOfCategory
}

class category {
public $avgPrice; // double
public $categoryID; // int
public $categoryName; // string
public $numberOfProducts; // int
public $selected; // boolean
}

class mutateCategories {
public $listofCategoryMutates; // ArrayOfCategoryMutate
}

class categoryMutate {
public $category; // category
}

class mutateCategoriesResponse {
public $listOfJobResponse; // ArrayOfCategoryMutateJobResponse
}

class categoryMutateJobResponse {
public $categoryMutate; // categoryMutate
}

class getBudgets {
public $budgetSelector; // BudgetSelectors
}

class BudgetSelectors {
public $budgetIDs; // ArrayOfInt
}

class getBudgetsResponse {
public $getBudgetsResult; // ArrayOfBudget
}

class budget {
public $budgetID; // int
public $budgetName; // string
public $totalAmount; // int
public $remainingBudget; // double
public $remainingBudgetUpdated; // string
}

class scheduleReportJob {
public $reportJob; // ReportJob
}

class ReportJob {
public $reportSelector; // ReportSelector
public $reportType; // ReportType
public $aggregationType; // AggregationType
public $startDate; // string
public $endDate; // string
public $selectedColumns; // ArrayOfReportColumn
public $isResultGzipped; // boolean
}

class ReportSelector {
public $CategoryIDs; // ArrayOfInt
public $CampaignIDs; // ArrayOfInt
public $BannerIDs; // ArrayOfInt
}

class ReportType {
const Campaign = 'Campaign';
const Banner = 'Banner';
const Category = 'Category';
}

class AggregationType {
const Hourly = 'Hourly';
const Daily = 'Daily';
}

class ReportColumn {
const clicks = 'clicks';
const impressions = 'impressions';
const ctr = 'ctr';
const revcpc = 'revcpc';
const ecpm = 'ecpm';
const cost = 'cost';
const sales = 'sales';
const convRate = 'convRate';
const orderValue = 'orderValue';
const salesPostView = 'salesPostView';
const convRatePostView = 'convRatePostView';
const orderValuePostView = 'orderValuePostView';
const costOfSale = 'costOfSale';
const impressionWin = 'impressionWin';
const costPerOrder = 'costPerOrder';
}

class scheduleReportJobResponse {
public $jobResponse; // ReportJobResponse
}

class ReportJobResponse {
public $reportJob; // ReportJob
}

class getJobStatus {
public $jobID; // long
}

class getJobStatusResponse {
public $getJobStatusResult; // JobStatus
}

class getReportDownloadUrl {
public $jobID; // long
}

class getReportDownloadUrlResponse {
public $jobURL; // string
}

class getStatisticsLastUpdate {
}

class getStatisticsLastUpdateResponse {
public $getStatisticsLastUpdateResult; // ArrayOfStatUpdate
}

class StatUpdate {
public $Type; // StatType
public $Date; // dateTime
}

class StatType {
const ClicksAndImpressions = 'ClicksAndImpressions';
const Sales = 'Sales';
}


/**
* CriteoAdvertiserAPI class
*
*
*
* @author {author}
* @copyright {copyright}
* @package {package}
*/
class CriteoAdvertiserAPI extends SoapClient {

private static $classmap = array(
'clientLogin' => 'clientLogin',
'clientLoginResponse' => 'clientLoginResponse',
'partnerLogin' => 'partnerLogin',
'partnerLoginResponse' => 'partnerLoginResponse',
'getAccount' => 'getAccount',
'getAccountResponse' => 'getAccountResponse',
'AdvertiserAccount' => 'AdvertiserAccount',
'apiHeader' => 'apiHeader',
'getCampaigns' => 'getCampaigns',
'CampaignSelectors' => 'CampaignSelectors',
'CampaignStatus' => 'CampaignStatus',
'biddingStrategy' => 'biddingStrategy',
'getCampaignsResponse' => 'getCampaignsResponse',
'campaign' => 'campaign',
'bidInformation' => 'bidInformation',
'CPCBid' => 'CPCBid',
'CPABid' => 'CPABid',
'categoryBid' => 'categoryBid',
'mutateCampaigns' => 'mutateCampaigns',
'campaignMutate' => 'campaignMutate',
'mutate' => 'mutate',
'OperationMutate' => 'OperationMutate',
'mutateCampaignsResponse' => 'mutateCampaignsResponse',
'campaignMutateJobResponse' => 'campaignMutateJobResponse',
'JobResponse' => 'JobResponse',
'JobStatus' => 'JobStatus',
'ApiExceptionData' => 'ApiExceptionData',
'ApiExceptionErrorCode' => 'ApiExceptionErrorCode',
'apiError' => 'apiError',
'ApiErrorCode' => 'ApiErrorCode',
'getCategories' => 'getCategories',
'CategorySelectors' => 'CategorySelectors',
'getCategoriesResponse' => 'getCategoriesResponse',
'category' => 'category',
'mutateCategories' => 'mutateCategories',
'categoryMutate' => 'categoryMutate',
'mutateCategoriesResponse' => 'mutateCategoriesResponse',
'categoryMutateJobResponse' => 'categoryMutateJobResponse',
'getBudgets' => 'getBudgets',
'BudgetSelectors' => 'BudgetSelectors',
'getBudgetsResponse' => 'getBudgetsResponse',
'budget' => 'budget',
'scheduleReportJob' => 'scheduleReportJob',
'ReportJob' => 'ReportJob',
'ReportSelector' => 'ReportSelector',
'ReportType' => 'ReportType',
'AggregationType' => 'AggregationType',
'ReportColumn' => 'ReportColumn',
'scheduleReportJobResponse' => 'scheduleReportJobResponse',
'ReportJobResponse' => 'ReportJobResponse',
'getJobStatus' => 'getJobStatus',
'getJobStatusResponse' => 'getJobStatusResponse',
'getReportDownloadUrl' => 'getReportDownloadUrl',
'getReportDownloadUrlResponse' => 'getReportDownloadUrlResponse',
'getStatisticsLastUpdate' => 'getStatisticsLastUpdate',
'getStatisticsLastUpdateResponse' => 'getStatisticsLastUpdateResponse',
'StatUpdate' => 'StatUpdate',
'StatType' => 'StatType',
);

public function CriteoAdvertiserAPI($wsdl = "https://advertising.criteo.com/api/v201010/advertiserservice.asmx?wsdl", $options = array()) {
foreach(self::$classmap as $key => $value) {
if(!isset($options['classmap'][$key])) {
$options['classmap'][$key] = $value;
}
}
parent::__construct($wsdl, $options);
}

/**
* 사용자 이름 및 암호와 함께 애플리케이션 토큰을 사용하여 클라이언트 로그인의 보안을 유지합니다.
*
*
* @param clientLogin $parameters
* @return clientLoginResponse
*/
public function clientLogin(clientLogin $parameters) {
return $this->__soapCall('clientLogin', array($parameters), array(
'uri' => 'https://advertising.criteo.com/API/v201010',
'soapaction' => ''
)
);
}

/**
* 사용자 이름 및 암호와 함께 애플리케이션 토큰을 사용하여 파트너 로그인의 보안을 유지합니다.
*
*
* @param partnerLogin $parameters
* @return partnerLoginResponse
*/
public function partnerLogin(partnerLogin $parameters) {
return $this->__soapCall('partnerLogin', array($parameters), array(
'uri' => 'https://advertising.criteo.com/API/v201010',
'soapaction' => ''
)
);
}

/**
* 광고주 계정 정보 반환
*
* @param getAccount $parameters
* @return getAccountResponse
*/
public function getAccount(getAccount $parameters) {
return $this->__soapCall('getAccount', array($parameters), array(
'uri' => 'https://advertising.criteo.com/API/v201010',
'soapaction' => ''
)
);
}

/**
* 각 캠페인의 범주별 CPC 입찰 전체를 포함하여 캠페인 정보를 반환합니다.
*
* @param getCampaigns $parameters
* @return getCampaignsResponse
*/
public function getCampaigns(getCampaigns $parameters) {
return $this->__soapCall('getCampaigns', array($parameters), array(
'uri' => 'https://advertising.criteo.com/API/v201010',
'soapaction' => ''
)
);
}

/**
* 캠페인 정보를 변화시킵니다. 캠페인별 글로벌 CPC 및 특정 범주의 입찰을 설정할 수
* 있습니다.
*
* @param mutateCampaigns $parameters
* @return mutateCampaignsResponse
*/
public function mutateCampaigns(mutateCampaigns $parameters) {
return $this->__soapCall('mutateCampaigns', array($parameters), array(
'uri' => 'https://advertising.criteo.com/API/v201010',
'soapaction' => ''
)
);
}

/**
* 카테고리 정보를 반환합니다. 해당 계정과 링크된 모든 카테고리를 볼 수 있습니다.
*
* @param getCategories $parameters
* @return getCategoriesResponse
*/
public function getCategories(getCategories $parameters) {
return $this->__soapCall('getCategories', array($parameters), array(
'uri' => 'https://advertising.criteo.com/API/v201010',
'soapaction' => ''
)
);
}

/**
* 카테고리 정보를 변경합니다. 입찰 및 보고 목적으로 선택되는 카테고리를 정의하는
* 데만 사용됩니다.
*
* @param mutateCategories $parameters
* @return mutateCategoriesResponse
*/
public function mutateCategories(mutateCategories $parameters) {
return $this->__soapCall('mutateCategories', array($parameters), array(
'uri' => 'https://advertising.criteo.com/API/v201010',
'soapaction' => ''
)
);
}

/**
* 예산 정보를 반환합니다.
*
* @param getBudgets $parameters
* @return getBudgetsResponse
*/
public function getBudgets(getBudgets $parameters) {
return $this->__soapCall('getBudgets', array($parameters), array(
'uri' => 'https://advertising.criteo.com/API/v201010',
'soapaction' => ''
)
);
}

/**
* 통계 보고서 작업을 예약합니다.
*
* @param scheduleReportJob $parameters
* @return scheduleReportJobResponse
*/
public function scheduleReportJob(scheduleReportJob $parameters) {
return $this->__soapCall('scheduleReportJob', array($parameters), array(
'uri' => 'https://advertising.criteo.com/API/v201010',
'soapaction' => ''
)
);
}

/**
* 비동기 작업(보고서 또는 변경)의 상태를 반환합니다. 현재 mutateCampaign 및
* scheduleReportJob용 작업에 적용됩니다.
*
* @param getJobStatus $parameters
* @return getJobStatusResponse
*/
public function getJobStatus(getJobStatus $parameters) {
return $this->__soapCall('getJobStatus', array($parameters), array(
'uri' => 'https://advertising.criteo.com/API/v201010',
'soapaction' => ''
)
);
}

/**
* reportURL을 조회합니다.
*
* @param getReportDownloadUrl $parameters
* @return getReportDownloadUrlResponse
*/
public function getReportDownloadUrl(getReportDownloadUrl $parameters) {
return $this->__soapCall('getReportDownloadUrl', array($parameters), array(
'uri' => 'https://advertising.criteo.com/API/v201010',
'soapaction' => ''
)
);
}

/**
* 최근 업데이트된 통계를 가져옵니다.
*
* @param getStatisticsLastUpdate $parameters
* @return getStatisticsLastUpdateResponse
*/
public function getStatisticsLastUpdate(getStatisticsLastUpdate $parameters) {
return $this->__soapCall('getStatisticsLastUpdate', array($parameters), array(
'uri' => 'https://advertising.criteo.com/API/v201010',
'soapaction' => ''
)
);
}

}

?>

 

 

Criteo TestConnect API

Criteo TestConnect API 코드의 예제가 아래에 나와 있습니다. 소스 파일을 여기에서 다운로드할 수도 있습니다. 

<<?php
//echo phpinfo();
include('./CriteoAdvertiserAPI.php');

ini_set('display_errors', 'On');
//turn off WSDP caching if not in a production environment
$ini = ini_set("soap.wsdl_cache_enabled","0");

define('APP_TOKEN',454561231);
define('USERNAME', 'fdsfds');
define('PASSWORD', 'fdsfdsds');
define('WSNAMESPANCE', 'https://advertising.criteo.com/API/v201010');
define('WSURL','https://advertising.criteo.com/api/v201010/advertiserservice.asmx?WSDL');

//instantiate the SOAP client
$options = array(
'soap_version'=>SOAP_1_2
,'exceptions'=>true //true
,'trace'=>0
,'cache_wsdl'=>WSDL_CACHE_NONE
// ,'proxy_host' => "localhost"
// ,'proxy_port' => 8888
);

try {

$soap_client = new CriteoAdvertiserAPI(WSURL,$options);

// CLIENTLOGIN
echo '<br/><b>clientLogin...</b><br/>';
$clientLogin = new clientLogin();
$clientLogin->username = USERNAME;
$clientLogin->password = PASSWORD;
$clientLogin->source = 'test';
$loginResponse = $soap_client->clientLogin($clientLogin);
$apiHeader = new apiHeader();
$apiHeader->appToken = APP_TOKEN;
$apiHeader->authToken = $loginResponse->clientLoginResult;
$apiHeader->clientVersion = 'test';

// PARTNERLOGIN
//$loginResponse = $soap_client->partnerLogin(array('appToken'=>APP_TOKEN,'username'=>USERNAME, 'password'=>PASSWORD, 'source'=>'test'));
//$apiHeader = new apiHeader($loginResponse->partnerLoginResult);

echo '<b>->apiHeader:</b>';
print_r($apiHeader);
echo "<br/>";

//Create Soap Header, then set the Headers of Soap Client.
$soapHeader = new SOAPHeader(WSNAMESPANCE, 'apiHeader', $apiHeader, false);
$soap_client->__setSoapHeaders(array($soapHeader));

// GETCAMPAIGN
echo '<br/><b>getCampaigns...</b><br/>';
$getCampaignsParameters = new getCampaigns();
$getCampaignsParameters->campaignSelector = new CampaignSelectors();
$getCampaignsParameters->campaignSelector->campaignStatus = array(CampaignStatus::RUNNING,CampaignStatus::NOT_RUNNING);
$result = $soap_client->getCampaigns($getCampaignsParameters);
if($result->getCampaignsResult->campaign != null)
$campaignId = $result->getCampaignsResult->campaign->campaignID;
else
$campaignId = $result->getCampaignsResult->campaign[0]->campaignID;
echo '-><b>first campaignId:</b>'.$campaignId."<br/>";

//MUTATECAMPAIGNS
echo '<br/><b>mutateCampaigns...</b><br/>';
$campaign = new campaign();
$campaign->campaignID = $campaignId;
//$campaign->status = CampaignStatus::RUNNING;

$categoryBid = new categoryBid();
$categoryBid->campaignCategoryUID = 29729;
$categoryBid->campaignID = $campaignId;
$categoryBid->categoryID = 87865678;
$categoryBid->selected = true;
$categoryBid->bidInformation = new bidInformation();
$categoryBid->bidInformation->biddingStrategy = biddingStrategy::Cpc;
$categoryBid->bidInformation->cpcBid = new CPCBid();
$categoryBid->bidInformation->cpcBid->cpc = 0.40;
$campaign->categoryBids = array($categoryBid);

$campaignMutate = new campaignMutate();
$campaignMutate->campaign = $campaign;
$campaignMutate->operationMutate = OperationMutate::SET;
//$campaignMutate = array('campaign' => $campaign, 'operationMutate' => OperationMutate::SET);
$mutateCampaignsParameters = new mutateCampaigns();
$mutateCampaignsParameters->listOfCampaignMutates = array($campaignMutate);
$result = $soap_client->mutateCampaigns($mutateCampaignsParameters);
echo '-><b>mutateCampaigns response:</b><br/>';
print_r($result);

echo "<br/>";

echo '<br/><b>scheduleReportJob...</b><br/>';
$scheduleReportJobParameters = new scheduleReportJob();
$scheduleReportJobParameters->reportJob = new ReportJob();
$scheduleReportJobParameters->reportJob->reportSelector = new ReportSelector();
$scheduleReportJobParameters->reportJob->reportSelector->CampaignIDs = array($campaignId);
$scheduleReportJobParameters->reportJob->reportType = ReportType::Campaign;
$scheduleReportJobParameters->reportJob->aggregationType = AggregationType::Daily;
$scheduleReportJobParameters->reportJob->startDate = '2012-07-01';
$scheduleReportJobParameters->reportJob->endDate = '2012-09-01';
$scheduleReportJobParameters->reportJob->selectedColumns = array();
$scheduleReportJobParameters->reportJob->isResultGzipped = false;

//print_r($scheduleReportJobParameters);
$result = $soap_client->scheduleReportJob($scheduleReportJobParameters);

echo '-><b>scheduleReportJob response:</b><br/>';
print_r($result);
$jobID = $result->jobResponse->jobID;

$jobIsPending = true;
while($jobIsPending == true) {
echo '<br/><b>getJobStatus...</b><br/>';
$getJobStatus = new getJobStatus();
$getJobStatus->jobID = $jobID;
$result = $soap_client->getJobStatus($getJobStatus);
echo '-><b>getJobStatus response:</b><br/>';
print_r($result);
if($result->getJobStatusResult == 'Completed')
$jobIsPending = false;
else
sleep(30);
}

echo '<br/><b>getReportDownloadUrl...</b><br/>';
$getReportDownloadUrl = new getReportDownloadUrl();
$getReportDownloadUrl->jobID = $jobID;
$result = $soap_client->getReportDownloadUrl($getReportDownloadUrl);
echo '-><b>getReportDownloadUrl response:</b><br/>';
print_r($result);
echo "<br/><a href='".$result->jobURL."'>".$result->jobURL."</a>";

}
catch (SoapFault $fault)
{
echo $fault->faultcode."-".$fault->faultstring;
}
catch (Exception $e) {
echo "<h2>Exception Error!</h2>";
echo $e->getMessage();
echo $soap_client->__getLastResponse();
}
?>

이 문서가 도움이 되었습니까?
1명 중 0명이 유용하다고 평가하였습니다.
Zendesk 제공