Aanmelden

Welkom bij ons Support Center

Voor hulp met integratie en live campagnes.

Welkom bij ons Support Center. Voor hulp met integratie en live campagnes.

Hoe kan ik aan de slag gaan met de Criteo API?

 Stel dit niet zelf in als u geen programmeur bent. Om aan de slag te gaan met de CriteoAPI is de expertise van een programmeur vereist voor het gebruik van web-API's.

Neem contact op met uw technische ondersteuningsteam. Zij kunnen u helpen bij het instellen.

 

Criteo API

Een voorbeeld van de Criteo API-code vindt u hieronder. Ook kunt u het bronbestand  hier downloaden 

<

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);

// Gebruik de authToken met de app
apiHeader header = new apiHeader();
header.appToken
header.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);
}

// Haalt alle actieve campagnes op
public campaign[] GetAllActiveCampaigns()
{
CampaignSelectors selector = new CampaignSelectors();
selector.campaignStatus = new CampaignStatus[] { CampaignStatus.RUNNING };
return c.getCampaigns(selector);
}

// Haalt alle categorieën op
public category[] GetAllCategories()
{
CategorySelectors selector = new CategorySelectors();
return c.getCategories(selector);
}
}
}

 

Criteo Advertiser API

Een voorbeeld van de Criteo Advertiser API-code vindt u hieronder. Ook kunt u het bronbestand hier downloaden. 

<

<?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);
}

/**
* Login van klanten wordt beveiligd met een applicatietoken in combinatie met gebruikersnaam en wachtwoord.
*
*
* @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' => ''
)
);
}

/**
* Login van partners wordt beveiligd met een applicatietoken in combinatie met gebruikersnaam en wachtwoord.
*
*
* @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' => ''
)
);
}

/**
* Retourneert accountinformatie over de adverteerder
*
* @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' => ''
)
);
}

/**
* Retourneert accountinformatie van de campagne, waaronder alle CPC-biedingen per categorie voor iedere campagne.
*
* @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' => ''
)
);
}

/**
* Muteer campagne-informatie. Wereldwijde CPC per campagne en specifieke categoriebiedingen kunnen worden
* ingesteld.
*
* @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' => ''
)
);
}

/**
* Retourneert categorie-informatie. Alle aan de account gekoppelde categorieën worden geretourneerd.
*
* @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' => ''
)
);
}

/**
* Muteert categorie-informatie. Kan alleen worden gebruikt om te definiëren welke categorieën worden geselecteerd
* voor Bieding en Rapportage.
*
* @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' => ''
)
);
}

/**
* Retourneert budgetinformatie.
*
* @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' => ''
)
);
}

/**
* Plant een job voor een statistisch rapport.
*
* @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' => ''
)
);
}

/**
* Retourneert de status van een asynchrone job (rapporteren of muteren). Momenteel van toepassing op jobs die zijn gemaakt
* voor mutateCampaign en 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 ophalen.
*
* @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' => ''
)
);
}

/**
* Laatste update van statistieken ophalen.
*
* @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

Een voorbeeld van de Criteo TestConnect API-code vindt u hieronder. Hier kunt u ook het bronbestand downloaden. 

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

ini_set('display_errors', 'On');
//schakel WSDP caching uit indien niet in een productie-omgeving
$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');

//instantieer de 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/>";

//Soap Header aanmaken, vervolgens Headers van Soap Client instellen.
$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();
}
?>

Was dit artikel nuttig?
Aantal gebruikers dat dit nuttig vond: 0 van 1
Mogelijk gemaakt door Zendesk