hi, 
I am using the  CustomerSyncService api to fetch account activity (v201605)
i'm getting the error UNEXPECTED_INTERNAL_API_ERROR while fetching account 
activity . This happens only for one client, for the rest of  clients this 
api is working fine. It was working fine for this client also till 6 jan bt 
today i am unable to fetch data for one specific client..

error which i got is :
[SoapFault] [InternalApiError.UNEXPECTED_INTERNAL_API_ERROR @ 
com.google.ads.api.services.common.error.InternalApiError.<init>(InternalApiErro]

any reasn for this ???
code is: 
  
  private function downloadCSVReportActivity($access_token, $expires_in,
$timestamp, $clientCustomerId, $fromDate, $toDate) {
        $user = new \AdWordsUser();
        $user->LogAll();
        $user->SetClientCustomerId($clientCustomerId);
        $oAuth2Info = $user->GetOAuth2Info();
        //SET access token value in oauth..
        //thsi is required while using new service 
        $oAuth2Info['access_token'] = $access_token;
        $oAuth2Info['expires_in'] = $expires_in;
        $oAuth2Info['timestamp'] = $timestamp;
        // Download report.
        $user->SetOAuth2Info($oAuth2Info);
        $campaignService = $user->GetService('CampaignService', 
ADWORD_VERSION);
        $customerSyncService = $user->GetService('CustomerSyncService', 
ADWORD_VERSION);


        // Get an array of all campaign ids.
        $campaignIds = array();
        $selector = new \Selector();
        $selector->fields = array('Id', 'Name', 'Status');
        $selector->paging = new \Paging(0, 500);
        $selector->predicates[] = new \Predicate('Status', 'IN', array(
'ENABLED'));
        do {
            $page = $campaignService->get($selector);
            if (isset($page->entries)) {
                foreach ($page->entries as $campaign) {
                    //get all campaign id corresponding to its name 
                    $campaignIds[$campaign->id] = $campaign->name;
                }
            }
            $selector->paging->startIndex += 500;
        } while ($page->totalNumEntries > $selector->paging->startIndex);
        $activityGraphArr = array();
        // Set the date time range, from 24 hours ago until now.
        $dateTimeRange = new \DateTimeRange();
        //initialize the count to 0
       if(!empty($campaignIds)){
        //bug fixed: display account activity for 90 days instead of 12 
weeks
        try{
                for ($i = 0; $i < 12; $i++) {
                $count = 0;
                //fetch data weekly.. so set date by subtracting the days 
from min nd max date
                $subDays = 7 * $i;
                $fdate = date('Y-m-d', strtotime('-' . $subDays . 'day', 
strtotime($fromDate)));
                $tdate = date('Y-m-d', strtotime('-' . $subDays . 'day', 
strtotime($toDate)));
                $dateTimeRange->min = date('Ymd his', strtotime($fdate));
                $dateTimeRange->max = date('Ymd his', strtotime($tdate));


                // Create selector.
                //get customer acc setting from $customerSyncService
                $selector = new \CustomerSyncSelector();
                $selector->dateTimeRange = $dateTimeRange;
                $selector->campaignIds = array_keys($campaignIds);


                // Make the get request.
                $accountChanges = $customerSyncService->get($selector);
                if (isset($accountChanges)) {
                    foreach ($accountChanges->changedCampaigns as 
$campaignChangeData) {
                        if ($campaignChangeData->campaignChangeStatus != 
'NEW') {
                            //add all the changes to get the total number 
of times changes
                            //are made
                            $count +=!empty($campaignChangeData->
removedAdExtensions) ?
                                    sizeOf($campaignChangeData->
removedAdExtensions) : 0;
                            $count +=!empty($campaignChangeData->
addedCampaignCriteria) ?
                                    sizeOf($campaignChangeData->
addedCampaignCriteria) : 0;
                            $count +=!empty($campaignChangeData->
removedCampaignCriteria) ?
                                    sizeOf($campaignChangeData->
removedCampaignCriteria) : 0;
                            if (isset($campaignChangeData->changedAdGroups)) 
{
                                foreach ($campaignChangeData->changedAdGroups 
as $adGroupChangeData) {
                                    if ($adGroupChangeData->adGroupChangeStatus 
!= 'NEW') {
                                         $count +=!empty($adGroupChangeData
->changedAds) ?
                                                sizeOf($adGroupChangeData->
changedAds) : 0;


                                    }
                                }
                            }
                        }
                    }
                   //push date and count into array
                    $graphArr[0] = $fdate;
                    $graphArr[1] = $count;
                    array_push($activityGraphArr, $graphArr);
                }
            }
        }catch (Exception $ex) {
            $this->log($ex->getMessage(), "error");
        }
       }
    return $activityGraphArr;
 }



-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/7eea06d6-a725-4cbd-b3ff-b13d18e51626%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • error UNEXPECTED... Pallavi Sharma
    • Re: error U... 'Vishal Vinayak (Adwords API Team)' via AdWords API Forum

Reply via email to