Okay. So I think I understand where the issue is.
I was creating a shared budget. so I have to delete the budget from the
shared budget list every time.
I added this field when I create a campaign budget which solved the issue
for me.
`explicitly_shared: false,`
const budget: MutateOperation<resources.ICampaignBudget>[] = [
{
entity: "campaign_budget",
operation: "create",
resource: {
resource_name: budgetResourceName, // Create a budget with
the temporary resource id
name: campaignBudgetName,
delivery_method: enums.BudgetDeliveryMethod.STANDARD,
amount_micros: toMicros(10),
explicitly_shared: false,
},
},
];
On Monday, 31 July 2023 at 12:08:59 UTC+5:30 Divya Patel wrote:
> My mistake with the removal operation. I used this 👇.
>
> const remove = {
> entity: "campaign_budget",
> operation: "remove",
> resource: getBudgetResourceName.campaign_budget.resource_name,
> };
>
> still the error is there.
>
> On Monday, 31 July 2023 at 12:06:53 UTC+5:30 Divya Patel wrote:
>
>> I am using "mutateResources()" method to create my campaign budget and
>> campaign.
>>
>> I create a campaign and then delete that campaign from the google ads
>> website. I do this for like 2 times and everything works properly. But
>> after the 2nd (or 3rd - not sure) time, it threw this error. (note that the
>> campaign is removed so I guess the campaign budget should also be removed.
>> even so, it gives this error).
>>
>> {
>> "error_code": {
>> "campaign_budget_error": "DUPLICATE_NAME"
>> },
>> "message": "A campaign budget with this name already exists.",
>> "trigger": {
>> "string_value": "ABC Budget"
>> },
>> "location": {
>> "field_path_elements": [
>> {
>> "field_name": "mutate_operations",
>> "index": 0
>> },
>> {
>> "field_name": "campaign_budget_operation"
>> },
>> {
>> "field_name": "create"
>> },
>> {
>> "field_name": "name"
>> }
>> ]
>> }
>> }
>>
>> so I tried to remove the campaign budget using an API. I refer to this
>> document
>> https://developers.google.com/google-ads/api/docs/campaigns/budgets/remove-budgets
>> and I also confirmed that the reference_count
>> <https://developers.google.com/google-ads/api/reference/rpc/v14/CampaignBudget#reference_count>
>> is
>> 0.
>>
>> const [getBudgetResourceName] = await customer.query(`
>> SELECT
>> campaign_budget.resource_name,
>> campaign_budget.reference_count,
>> campaign_budget.status
>> FROM
>> campaign_budget
>> WHERE
>> campaign_budget.name = '${campaignBudgetName}'
>> `);
>>
>> const remove = {
>> entity: "campaign_budget",
>> operation: "update",
>> resource: getBudgetResourceName.campaign_budget.resource_name,
>> };
>>
>> after this the status of that campaign budget changes from ENABLED/PAUSED
>> to REMOVE.
>>
>> after this, I am trying to create a new campaign budget with the same
>> name. It still gives the same error.
>>
>> {
>> "error_code": {
>> "campaign_budget_error": "DUPLICATE_NAME"
>> },
>> "message": "A campaign budget with this name already exists.",
>> "trigger": {
>> "string_value": "ABC Budget"
>> },
>> "location": {
>> "field_path_elements": [
>> {
>> "field_name": "mutate_operations",
>> "index": 0
>> },
>> {
>> "field_name": "campaign_budget_operation"
>> },
>> {
>> "field_name": "create"
>> },
>> {
>> "field_name": "name"
>> }
>> ]
>> }
>> }
>>
>> So, can you please help me with this? What is the correct way to delete a
>> campaign budget? Or if there is any condition that needs to be checked?
>>
>>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/026c3522-62b7-42c9-8966-09cabd24a2dan%40googlegroups.com.