Closed AlexRyabikov closed 1 year ago
Can you try the steps to run code examples? Would that return anything?
Hi! Yes, examples are working, and some other scripts based on examples are OK (account management for example).
I have a problem with updating account budget proposal. And guys from google ads api forum sent me here.
In my previous something wrong with my code, sorry. Here is normal version:
Logger and script doesnt return anything
When you say it's not sending a request, what happened? Nothing is shown? Usually, they should be some logs on screen even if you do something wrong. Is it possible for you to turn off logging so it show the result on screen instead?
Yep, you right, nothing is shown. It had returned some errors in case when I forgot to add some parts of library (use Google\Ads\GoogleAds\Util\FieldMasks, for example), but now just nothing: no logs, no errors. I have no idea why, unfortunately.
About line to fix (setCreate) - it's strange, because Google use it in this example: https://developers.google.com/google-ads/api/docs/billing/account-budgets?hl=en#php
Also on screenshot in attache:
Sorry. It's an account budget proposal, so using setCreate
is already fine.
The reason why there is nothing shown is that you've not sent your request yet.
You have to use AccountBudgetProposalServiceClient
to send your request just like you do when adding a new account budget proposal
Hi! Yes, you were right :) Problem solved. Thnx for help :)
Hi!
I've enabled logger in configuration file but it doesnt work in this case (and works with all library examples), or my script does not send the request.
Here is my code, that based on example "add budget proposal" and https://developers.google.com/google-ads/api/docs/billing/account-budgets?hl=en#end code from docs.
<?php
namespace Google\Ads\GoogleAds\Examples\Billing;
require DIR . '/../../vendor/autoload.php';
use GetOpt\GetOpt; use Google\Ads\GoogleAds\Examples\Utils\ArgumentNames; use Google\Ads\GoogleAds\Examples\Utils\ArgumentParser; use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder; use Google\Ads\GoogleAds\Lib\V12\GoogleAdsClient; use Google\Ads\GoogleAds\Lib\V12\GoogleAdsClientBuilder; use Google\Ads\GoogleAds\Lib\V12\GoogleAdsException; use Google\Ads\GoogleAds\Util\V12\ResourceNames; use Google\Ads\GoogleAds\V12\Enums\AccountBudgetProposalTypeEnum\AccountBudgetProposalType; use Google\Ads\GoogleAds\V12\Enums\TimeTypeEnum\TimeType; use Google\Ads\GoogleAds\V12\Errors\GoogleAdsError; use Google\Ads\GoogleAds\V12\Resources\AccountBudgetProposal; use Google\Ads\GoogleAds\V12\Services\AccountBudgetProposalOperation; use Google\ApiCore\ApiException;
/**
budget proposals, run GetAccountBudgetProposals.php */ class AddAccountBudgetProposal { private const CUSTOMER_ID = '3721199407'; private const BILLING_SETUP_ID = '6885573946';
public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::BILLING_SETUP_ID => GetOpt::REQUIRED_ARGUMENT ]);
}
/**
$accountBudgetProposal = new AccountBudgetProposal([ 'billing_setup' => ResourceNames::forBillingSetup($customerId, $billingSetupId), 'proposal_type' => AccountBudgetProposalType::END, 'account_budget' => 'customers/3721199407/accountBudgets/6885650342' ]); $accountBudgetProposalOperation = new AccountBudgetProposalOperation(); $accountBudgetProposalOperation->setCreate($accountBudgetProposal);
}
AddAccountBudgetProposal::main();
?>
I'm sure, that I did something wrong, but idk what could be wrong
Can you help me please?