banboo-data / RCriteo

Loading Criteo Campaign Data into R
http://jburkhardt.github.io/RCriteo/
Other
6 stars 3 forks source link

getCriteoCampaign does not return value #8

Closed chawannut157 closed 7 years ago

chawannut157 commented 7 years ago

I notice there's a problem with getCriteoCampaign command for some account. For example, nothing is returned as shown below when using this command for one of the account.

image

However, rerunning the same command 5 minutes later show the result.

image

Not sure if anyone experiene this problem before ?

jburkhardt commented 7 years ago

I never experienced the same behaviour.

In both of your cases stated above the R code (R package) is running stable and returns the given result of the API.

The question is why are there no data in the first attempt. Could it be that there were connection issues with the Criteo API, Internet connection or anything alike? Can you reproduce the issue?

jburkhardt commented 7 years ago

If you want to investigate any further you could run the code below and inspect the http status code (e.g. if there are server issues like 503, etc.).

body = paste('<?xml version="1.0" encoding="utf-8"?>
               <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
               <soap:Header>
               <apiHeader xmlns="https://advertising.criteo.com/API/v201010">
               <authToken>', authToken ,'</authToken>
               <appToken>', appToken ,'</appToken>
               <clientVersion>string</clientVersion>
               </apiHeader>
               </soap:Header>
               <soap:Body>
               <getCampaigns xmlns="https://advertising.criteo.com/API/v201010">
               <campaignSelector>
               <campaignIDs>
               </campaignIDs>
               <budgetIDs>
               </budgetIDs>
               <campaignStatus>
               </campaignStatus>
               <biddingStrategy>
               </biddingStrategy>
               </campaignSelector>
               </getCampaigns>
               </soap:Body>    
               </soap:Envelope>',sep="")

  headerFields = c(Accept = "text/xml",
                   Accept = "multipart/*",
                   'Content-Type' = "text/xml; charset=utf-8",
                   SOAPAction = "https://advertising.criteo.com/API/v201010/getCampaigns")

  h = RCurl::basicTextGatherer()

  RCurl::curlPerform(url = "https://advertising.criteo.com/API/v201010/AdvertiserService.asmx",
                     httpheader = headerFields,
                     postfields = body,
                     writefunction = h$update
  )

  xml <- sub('xmlns="https://advertising.criteo.com/API/v201010"','',h$value())
doc <- XML::xmlRoot(XML::xmlTreeParse(xml, useInternalNodes = TRUE))