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/f9914d6c-7300-4042-b281-d7fa29b8c9f4n%40googlegroups.com.
  • Ca... Divya Patel
    • ... Divya Patel
      • ... Divya Patel
        • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to