Hello,
Similar to the example for creating and editing a company (which works for 
me), I tried to write a function to update the budget. Unfortunately, I'm 
getting an error. What am I doing wrong? Below function code and error from 
console.

public function run(
GoogleAdsClient $googleAdsClient,
int $customerId,
int $campaignId
) {
$campaignBudget = new CampaignBudget([
'resource_name' => ResourceNames::forCampaignBudget($customerId, 
$campaignId),
'amount_micros' => 1000000
]);

$campaignBudgetOperation = new CampaignBudgetOperation();
$campaignBudgetOperation->setUpdate($campaignBudget);
$campaignBudgetOperation->setUpdateMask(FieldMasks::allSetFieldsOf
($campaignBudget));

$campaignBudgetServiceClient = 
$googleAdsClient->getCampaignBudgetServiceClient();
$response = 
$campaignBudgetServiceClient->mutateCampaignBudgets($customerId, 
[$campaignBudgetOperation]);

/** @var Campaign $updatedCampaign */
$updatedCampaign = $response->getResults()[0];
printf(
"Updated campaign with resource name: '%s'%s",
$updatedCampaign->getResourceName(),
PHP_EOL
);
}

Error:

ApiException was thrown with message '{
    "message": "Request contains an invalid argument.",
    "code": 3,
    "status": "INVALID_ARGUMENT",
    "details": [
        {
            "@type": 
"type.googleapis.com\/google.ads.googleads.v10.errors.GoogleAdsFailure",
            "errors": [
                {
                    "errorCode": {
                        "mutateError": "RESOURCE_NOT_FOUND"
                    },
                    "message": "Resource was not found.",
                    "trigger": {
                        "int64Value": "399614050"
                    },
                    "location": {
                        "fieldPathElements": [
                            {
                                "fieldName": "operations",
                                "index": 0
                            },
                            {
                                "fieldName": "update"
                            },
                            {
                                "fieldName": "resource_name"
                            }
                        ]
                    }
                }
            ],
            "requestId": "XER3E1EKsKH178ne_lAN4A"
        }
    ]
}'.
The error also appears when trying to update other properties.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/be0cb317-90e1-453c-b5e5-abb3bc6c1c63n%40googlegroups.com.

Reply via email to