Update Campaign to REMOVED status using Api

65 views
Skip to first unread message

Pietro Galassi

unread,
Jan 31, 2020, 6:07:43 AM1/31/20
to AdWords API and Google Ads API Forum
Hi,

we tried to update a campaign status to REMOVED using apis:
{
    "operations": {
    "updateMask": "status",
        "update": {
        "resource_name": "customers/2017233623/campaigns/9151140201",
    "status": "REMOVED"
        }
    }
}

but we get:
{
    "error": {
        "code": 400,
        "message": "Request contains an invalid argument.",
        "status": "INVALID_ARGUMENT",
        "details": [
            {
                "errors": [
                    {
                        "errorCode": {
                            "requestError": "INVALID_ENUM_VALUE"
                        },
                        "message": "Enum value 'REMOVED' cannot be used.",
                        "location": {
                            "fieldPathElements": [
                                {
                                    "fieldName": "operations",
                                    "index": "0"
                                },
                                {
                                    "fieldName": "update"
                                },
                                {
                                    "fieldName": "status"
                                }
                            ]
                        }
                    }
                ]
            }
        ]
    }
}

While if we do it from Google Ads Console it works and campaign is returned with status 'REMOVED'.

How to do it with api ?

Regards,
Pierpaolo

Google Ads API Forum Advisor Prod

unread,
Jan 31, 2020, 2:43:04 PM1/31/20
to pietro....@gmail.com, adwor...@googlegroups.com

Hi Pietro,

Thank you for reaching out to us. I see that you want to remove a campaign through Google Ads API. Could I confirm with you if you are using our Client Libraries to remove the campaign? If so,you can see this example of how to remove a campaign in Google Ads API, or this example of how to update a campaign’s status. Please let me know if you have further questions.

Thank you,
Bryan, Google Ads API Team



ref:_00D1U1174p._5001UUzrsb:ref

Pietro Galassi

unread,
Feb 3, 2020, 2:53:06 AM2/3/20
to AdWords API and Google Ads API Forum
Hi,

a) The example gives you how to remove a campaign. But removing this way it NOT set the status to REMOVED but instead it fisically removes it. --> Not working as Google Ads Console that put the status to REMOVED.
b) Updating the status to REMOVED with Update operation gives you the error i already reported : "message": "Enum value 'REMOVED' cannot be used.". --> Not working as Google Ads Console that put the status to REMOVED.

So, how to set status to REMOVED using apis ? Both the examples you reported are not working this way.

Regards,
Pietro

Google Ads API Forum Advisor Prod

unread,
Feb 3, 2020, 2:13:46 PM2/3/20
to pietro....@gmail.com, adwor...@googlegroups.com

Hi Pietro,

I would like to clarify that this example of how to remove a campaign does not physically remove the campaign; it changes the status to REMOVED. I tested this to confirm by creating a test campaign, then used the example code to remove the campaign. I checked back in the UI and used the get campaigns example to check the status of the campaign and it is updated to removed. When you check in the Google Ads UI, make sure the filter is set to “All”, which will show campaigns with the “removed” status. Here is the result I obtained after using the example. 

Body: results {
  campaign {
    resource_name: "customers/………./campaigns/………."
    id {
      value: 8399049790
    }
    name {
      value: "My Test Campaign"
    }
    status: REMOVED
  }
}

Pietro Galassi

unread,
Feb 4, 2020, 2:52:43 AM2/4/20
to AdWords API and Google Ads API Forum
Hum,

thanks a lot!

Regards,
Pierpaolo
Reply all
Reply to author
Forward
0 new messages