Hi,
Could you please clarify what calls you are making with the API? If you
follow the Getting Started with the
Sandbox<https://developers.google.com/adwords/api/docs/sandbox#getting-started>mini-guide,
it will have you Add some campaigns and then Get them to verify
your account has data. A brand-new sandbox account won't have any data in
it.
- Kevin Winter
AdWords API Team
On Monday, August 20, 2012 10:19:54 AM UTC-4, Goran Jakovljevic wrote:
>
> Just a quick question as ive started working with Google API today and
> couldnt get any data, keep getting " Customer ID: 7512789598 Customer
> ID: 5743374498 Customer ID: 4011561396 Customer ID: 5409744600 Customer ID:
> 3101657547 No matching campaigns were found. " as i am going through
> sandbox I suppose that I am having same problem as everyone else ? If
> someone can confirm this so that i dont lose time trying to fix it.
>
> Here is also the code:
>
> <?php
>>
>>
>>
>> require_once '../src/Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
>>
>>
>>
>> $username = "*********";
>>
>> $password = "******";
>>
>> $currencyCode = "******";
>>
>> $developerToken = "************";
>>
>>
>>
>> $user = new AdWordsUser(null, $username, $password, $developerToken);
>>
>> $user->SetDefaultServer("https://adwords-sandbox.google.com/");
>>
>> $user->LogAll();
>>
>> $user->SetClientId(null);
>>
>>
>>
>> try {
>>
>> $campaignService = $user->GetService("CampaignService", 'v201109');
>>
>> $page = $campaignService->get(new Selector());
>>
>> } catch (Exception $e) {}
>>
>>
>>
>> $accountService = $user->GetService("ServicedAccountService", 'v201109');
>>
>> $selector = new ServicedAccountSelector();
>>
>> $page = $accountService->get($selector);
>>
>>
>>
>> foreach ($page->accounts as $account) {
>>
>> print "Customer ID: {$account->customerId}\n";
>>
>> }
>>
>>
>>
>> $customerId = $page->accounts[0]->customerId;
>>
>> $user->SetClientId($customerId);
>>
>>
>>
>> $campaignService = $user->GetService("CampaignService", 'v201109');
>>
>>
>>
>> $campaign = new Campaign();
>>
>> $campaign->name = "Test Sandbox Account #" + time();
>>
>> $campaign->status = "ACTIVE";
>>
>> $campaign->biddingStrategy = new ManualCPC();
>>
>>
>>
>> $budget = new Budget();
>>
>> $budget->period = 'DAILY';
>>
>> $budget->amount = new Money((float) 10000000);
>>
>> $budget->deliveryMethod = 'STANDARD';
>>
>> $campaign->budget = $budget;
>>
>>
>>
>> $networkSetting = new NetworkSetting();
>>
>> $networkSetting->targetGoogleSearch = TRUE;
>>
>> $campaign->networkSetting = $networkSetting;
>>
>>
>>
>> $operation = new CampaignOperation();
>>
>> $operation->operand = $campaign;
>>
>> $operation->operator = 'ADD';
>>
>>
>>
>> $operations = array($operation);
>>
>> $result = $campaignService->mutate($operations);
>>
>>
>>> //echo $result->value[0]->id;
>>
>> //print_r($result);
>>
>>
>>> //exit;
>>
>>
>>>
>>> try {
>>
>>
>>> $campaignService = $user->GetService('CampaignService', 'v201109');
>>
>> // Create selector.
>>
>> $selector = new Selector();
>>
>> $selector->fields =
>>
>> array('Id', 'Name', 'Impressions', 'Clicks', 'Cost', 'Ctr');
>>
>> $selector->predicates[] =
>>
>> new Predicate('Impressions', 'GREATER_THAN', array(0));
>>
>>
>>> // Set date range to request stats for.
>>
>> $dateRange = new DateRange();
>>
>> $dateRange->min = date('Ymd', strtotime('-1 week'));
>>
>> $dateRange->max = date('Ymd', strtotime('-1 day'));
>>
>> $selector->dateRange = $dateRange;
>>
>>
>>
>> $campaignId = '';
>>
>>
>>> // Create selector.
>>
>> //$selector->ids = array($result->value[0]->id);
>>
>>
>>> // Create paging controls.
>>
>> $selector->paging = new Paging(0,
>>> AdWordsConstants::RECOMMENDED_PAGE_SIZE);
>>
>>
>>> do {
>>
>> // Make the get request.
>>
>> $page = $campaignService->get($selector);
>>
>> //print_r($page);
>>
>>
>>> // Display results.
>>
>> if (isset($page->entries)) {
>>
>> foreach ($page->entries as $campaign) {
>>
>> printf("Campaign with name '%s' and id '%s' had the following
>>> stats "
>>
>> . "during the last week:\n", $campaign->name, $campaign->id);
>>
>> printf(" Impressions: %d\n",
>>> $campaign->campaignStats->impressions);
>>
>> printf(" Clicks: %d\n", $campaign->campaignStats->clicks);
>>
>> printf(" Cost: $%.2f\n",
>>> $campaign->campaignStats->cost->microAmount
>>
>> / AdWordsConstants::MICROS_PER_DOLLAR);
>>
>> printf(" CTR: %.2f%%\n", $campaign->campaignStats->ctr * 100);
>>
>> }
>>
>> } else {
>>
>> print "No matching campaigns were found.\n";
>>
>> }
>>
>>
>>> // Advance the paging index.
>>
>> $selector->paging->startIndex +=
>>> AdWordsConstants::RECOMMENDED_PAGE_SIZE;
>>
>> } while ($page->totalNumEntries > $selector->paging->startIndex);
>>
>>
>>>
> On Monday, August 13, 2012 5:44:51 PM UTC+2, Kevin Winter wrote:
>>
>> Hi all,
>> We apologize for this inconvenience. We're working on implementing and
>> testing a fix that we hope to roll out in the coming week or two.
>>
>> - Kevin Winter
>> AdWords API Team
>>
>> On Saturday, August 11, 2012 6:09:26 AM UTC-4, James Scott wrote:
>>>
>>>
>>>
>>> On Wednesday, July 25, 2012 10:56:51 PM UTC+2, Sander wrote:
>>>>
>>>> Hello Kevin,
>>>>
>>>> I took my problem out of the running topic on
>>>> https://groups.google.com/forum/?fromgroups#!topic/adwords-api/RuzzccFvpE8
>>>> to
>>>> avoid confusion and because that discussion is flagged as answered.
>>>>
>>>>
>>>> I just made a brand new account, but have the same result with zeros :
>>>>
>>>> My code:
>>>>
>>>> $user = new AdWordsUser(null, $username, $password, $developerToken);
>>>> $user->SetDefaultServer("https://adwords-sandbox.google.com/");
>>>> $user->SetClientId(null);
>>>>
>>>> $campaignService = $user->GetService('CampaignService', 'v201109_1');
>>>> // Create selector.
>>>> $selector = new Selector();
>>>> $selector->fields = array('Id', 'Name');
>>>> $selector->ordering[] = new OrderBy('Name', 'ASCENDING');
>>>> // Create paging controls.
>>>> $selector->paging = new Paging(0,
>>>> AdWordsConstants::RECOMMENDED_PAGE_SIZE);
>>>> do {
>>>> // Make the get request.
>>>> $page = $campaignService->get($selector);
>>>> // Display results.
>>>> if (isset($page->entries)) {
>>>> foreach ($page->entries as $campaign) {
>>>> printf("Campaign with name '%s' and id '%s' was found.\n",
>>>> $campaign->name, $campaign->id);
>>>> }
>>>> } else {
>>>> print "No campaigns were found.\n";
>>>> }
>>>> // Advance the paging index.
>>>> $selector->paging->startIndex +=
>>>> AdWordsConstants::RECOMMENDED_PAGE_SIZE;
>>>> } while ($page->totalNumEntries > $selector->paging->startIndex);
>>>>
>>>>
>>>> $campaignService = $user->GetService('CampaignService',
>>>> 'v201109');
>>>> $customerSyncService = $user->GetService('CustomerSyncService',
>>>> 'v201109');
>>>>
>>>> $accountService = $user->GetService("ServicedAccountService",
>>>> 'v201109');
>>>> $selector = new ServicedAccountSelector();
>>>> $page = $accountService->get($selector);
>>>>
>>>> echo "<PRE>";
>>>> print_r($page);
>>>> foreach ($page->accounts as $account) {
>>>> print "Customer ID: {$account->customerId}\n";
>>>> }
>>>>
>>>> Resulting in:
>>>>
>>>> No campaigns were found.
>>>>
>>>> ServicedAccountGraph Object
>>>> (
>>>> [accounts] => Array
>>>> (
>>>> [0] => Account Object
>>>> (
>>>> [customerId] => 0
>>>> [login] => [email protected]
>>>> [companyName] =>
>>>> [canManageClients] =>
>>>> [currencyCode] =>
>>>> [dateTimeZone] =>
>>>> )
>>>>
>>>> [1] => Account Object
>>>> (
>>>> [customerId] => 0
>>>> [login] => [email protected]
>>>>
>>>> [companyName] =>
>>>> [canManageClients] =>
>>>> [currencyCode] =>
>>>> [dateTimeZone] =>
>>>> )
>>>>
>>>>
>>>> Am I in the wrong ?
>>>>
>>>
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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