Hi,
I am using Ads API v10 with PHP. And i can't update campaign budget with update sample.
Do I always have to create a new budget and add it to that campaign to update the budget? Like this:
$budget = new CampaignBudget([
'name' => $budgetId.time(),
'amount_micros' => $amount
]);
$campaignBudgetOperation = new CampaignBudgetOperation();
$campaignBudgetOperation->setCreate($budget);
$campaignBudgetServiceClient = $googleAdsClient->getCampaignBudgetServiceClient();
$response = $campaignBudgetServiceClient->mutateCampaignBudgets(
$customerId,
[$campaignBudgetOperation]
);
$addedBudget = $response->getResults()[0];
$budgetResourceName = $addedBudget->getResourceName();
$campaign = new Campaign([
'resource_name' => ResourceNames::forCampaign($customerId, $campaignId),
'campaign_budget' => $budgetResourceName
]);
$campaignOperation = new CampaignOperation();
$campaignOperation->setUpdate($campaign);
$campaignOperation->setUpdateMask(FieldMasks::allSetFieldsOf($campaign));
$campaignServiceClient = $googleAdsClient->getCampaignServiceClient();
$response = $campaignServiceClient->mutateCampaigns(
$customerId,
[$campaignOperation]
);
$updatedCampaign = $response->getResults()[0];
Is there no way to update the existing budget with the budget id?