Hi, Please ensure you are adding the campaign to a client account and not the MCC account. There have been some permission issues with the sandbox recently, so you may want to try creating a new sandbox account with a fresh login.
Best, - Eric Koleda, AdWords API Team On Wednesday, March 7, 2012 3:57:50 AM UTC-5, Γιάννης Τραχαλάκης wrote: > > Hello All > > I am trying to run the add campaing example in the sandbox enviroment but > keep getting [AuthorizationError.USER_PERMISSION_DENIED @] > The code I am using is the following....can anyone help? (I should not > here that the customers that get initialized always have customerId = 0 is > this normal?) > > $user = new AdWordsUser(null, 'm...@gmail.com', 'mypassword', 'm...@gmail.com > ++USD'); > $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"; > $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); > > print_r($result); -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en