Connexion

Bienvenue sur notre Centre de Support

Obtenez de l'aide sur l'intégration et sur vos campagnes.

Bienvenue sur notre Centre de Support. Obtenez de l'aide sur l'intégration et sur vos campagnes.

Comment débuter avec l'API Criteo ?

Si vous n'êtes pas un programmeur, nous vous conseillons de ne pas réaliser cette intégration sans aide. Afin de débuter avec l'application Criteo, l'expertise d'un programmeur est nécessaire pour utiliser les API de services Internet.

Veuillez contacter votre équipe d'assistance technique qui sera en mesure de vous assister pendant le processus de configuration.

 

API Criteo

Vous trouverez ci-dessous un exemple de code API Criteo. Vous pouvez également télécharger le fichier source ici.

<

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

// Use the authToken with the app
api header 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);
}

// Retrieves all active campaigns
public campaign[] GetAllActiveCampaigns()
{
CampaignSelectors selector = new CampaignSelectors();
selector.campaignStatus = new CampaignStatus[] { CampaignStatus.RUNNING };
return c.getCampaigns(selector);
}

// Retrieves all categories
public category[] GetAllCategories()
{
CategorySelectors selector = new CategorySelectors();
return c.getCategories(selector);
}
}
}

 

Criteo Adviser API (API Annonceur Criteo)

Vous trouverez un exemple de code de l'API Criteo Advertiser ci-dessous. Vous pouvez également télécharger le fichier source ici. 

<

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


* La connexion client est sécurisée grâce à l'utilisation d'un jeton d'application, accompagné d'un nom d'utilisateur et d'un mot de passe.

*
* @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' => ''
)
);
}


* La connexion partenaire est sécurisée grâce à l'utilisation d'un jeton d'application, accompagné d'un nom d'utilisateur et d'un mot de passe.

*
* @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' => ''
)
);
}


* Affiche les informations du compte utilisateur
*
* @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' => ''
)
);
}


* Affiche les informations de la campagne, y compris toutes les enchères CPC par catégorie pour chaque 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' => ''
)
);
}


* Mutate campaign information. Tous les CPC par campagne et les enchères de catégories spécifiques peuvent être
* configurés.

* @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' => ''
)
);
}


* Affiche les informations des catégories. Toutes les catégories de ce compte sont affichées.

* @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' => ''
)
);
}


* Mutate category information. Peut uniquement être utilisé pour définir quelles catégories seront sélectionnées
* pour les enchères et le reporting.

* @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' => ''
)
);
}


* Affiche les informations du budget.

* @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' => ''
)
);
}


* Programme la création d'un rapport statistique.
*
* @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' => ''
)
);
}


* Affiche le statut d'un travail asynchrone (rapport ou "mutate"). S'applique couramment aux travaux créés
* pour mutateCampaign et 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' => ''
)
);
}


* Afficher 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' => ''
)
);
}


* Affiche les dernières actualisations des statistiques.

* @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' => ''
)
);
}

}

?>

 

 

API Criteo TestConnect

Vous trouverez ci-dessous un exemple de code TestConnect de l'API Criteo. Vous pouvez également télécharger le fichier source ici. 


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


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


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.

$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/>";


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

Cet article vous a-t-il été utile ?
Utilisateurs qui ont trouvé cela utile : 0 sur 1
Réalisé par Zendesk