Hi! 

Sorry for delay. 

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
 
this 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;

/**
 * This example creates an account budget proposal using the 'CREATE' 
operation. To get account
 * 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
        ]);

        // Generate a refreshable OAuth2 credential for authentication.
        $oAuth2Credential = (new OAuth2TokenBuilder())->fromFile()->build();

        // Construct a Google Ads client configured from a properties file 
and the
        // OAuth2 credentials above.
        $googleAdsClient = (new GoogleAdsClientBuilder())->fromFile()
            ->withOAuth2Credential($oAuth2Credential)
            ->build();

        try {
            self::runExample(
                $googleAdsClient,
                $options[ArgumentNames::CUSTOMER_ID] ?: self::CUSTOMER_ID,
                $options[ArgumentNames::BILLING_SETUP_ID] ?: 
self::BILLING_SETUP_ID
            );
        } catch (GoogleAdsException $googleAdsException) {
            printf(
                "Request with ID '%s' has failed.%sGoogle Ads failure 
details:%s",
                $googleAdsException->getRequestId(),
                PHP_EOL,
                PHP_EOL
            );
            foreach 
($googleAdsException->getGoogleAdsFailure()->getErrors() as $error) {
                /** @var GoogleAdsError $error */
                printf(
                    "\t%s: %s%s",
                    $error->getErrorCode()->getErrorCode(),
                    $error->getMessage(),
                    PHP_EOL
                );
            }
            exit(1);
        } catch (ApiException $apiException) {
            printf(
                "ApiException was thrown with message '%s'.%s",
                $apiException->getMessage(),
                PHP_EOL
            );
            exit(1);
        }
    }

    /**
     * Runs the example.
     *
     * @param GoogleAdsClient $googleAdsClient the Google Ads API client
     * @param int $customerId the customer ID
     * @param int $billingSetupId the billing setup ID used to add the 
account budget proposal
     */
    // [START add_account_budget_proposal]
    public static function runExample(
        GoogleAdsClient $googleAdsClient,
        int $customerId,
        int $billingSetupId
    ) {
        // Constructs an account budget proposal.



        
        
$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);


    }
    // [END add_account_budget_proposal]
}

AddAccountBudgetProposal::main();

?>



*I'm sure, that I did something wrong, but idk what could be wrong*

Can you help me please? 

среда, 1 февраля 2023 г. в 18:37:37 UTC+3, Алексей Рябиков: 

> Hi! Thnx for recommendation. I'll and came back with information
>
> вторник, 31 января 2023 г. в 18:39:19 UTC+3, adsapi: 
>
>> Hi,
>>
>> Thank you for reaching out to the Google Ads API support team.
>>
>> With regards to your concern, can you please provide first the complete 
>> *request* 
>> <https://developers.google.com/google-ads/api/docs/concepts/field-service#request>
>>  and *response* 
>> <https://developers.google.com/google-ads/api/docs/concepts/field-service#response>
>>  logs 
>> with *request ID* 
>> <https://developers.google.com/google-ads/api/docs/concepts/call-structure#request-id>
>>  and *request header* 
>> <https://developers.google.com/google-ads/api/docs/concepts/call-structure#request_headers>
>>  generated 
>> on your end so our team can provide guidance accordingly? If you haven't 
>> yet, logging can be enabled by navigating to the Client libraries > Your 
>> client library > Logging documentation, which you can access from this 
>> link 
>> <https://developers.google.com/google-ads/api/docs/client-libs?hl=en>.
>>
>> You may then send the requested logs via the *Reply privately to author* 
>> option. If this option is not available, you may send the details directly 
>> to our googleadsa...@google.com alias instead.
>>
>> Regards,
>> [image: Google Logo] 
>> Carmela 
>> Google Ads API Team 
>>   
>>
>> ref:_00D1U1174p._5004Q2iPitT:ref
>>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/7396c565-56fe-4d67-a7f7-5a0c7d03de36n%40googlegroups.com.
  • En... Алексей Рябиков
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
      • ... Алексей Рябиков
        • ... Алексей Рябиков
          • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to