Opteo / google-ads-api

Google Ads API client library for Node.js
https://opteo.com
MIT License
269 stars 90 forks source link

Mutate operations must have 'create', 'update', or 'remove' specified #331

Open hcyildirim opened 3 years ago

hcyildirim commented 3 years ago

Hi, I'm trying to delete a campaign and I'm getting an error:

 await customer.mutateResources([
      {
        entity: 'campaign',
        operation: 'remove',
        resource_name: resource_name,
      },
    ]);
 {
            "error_code": {
                "request_error": "OPERATION_REQUIRED"
            },
            "message": "Mutate operations must have 'create', 'update', or 'remove' specified.",
            "location": {
                "field_path_elements": [
                    {
                        "field_name": "mutate_operations",
                        "index": 0
                    },
                    {
                        "field_name": "campaign_operation"
                    }
                ]
            }
        }
kyryl-perepelytsia commented 3 years ago

Hi, i have same problem, with CustomerUserAccess and CustomerUserAccessInvitation resources, when trying to make any mutation operation

@hcyildirim have you found a way how to solve it ?

receving same response

GoogleAdsFailure {
  errors: [
    GoogleAdsError {
    error_code: [ErrorCode],
      message: "Mutate operations must have 'create', 'update', or 'remove' specified.",
     location: [ErrorLocation]
    }
  ],
   request_id: 'llPd2Z1j81XqbgfwBw8BpQ'
 }
jRexhmati commented 1 year ago

Hello 👋 I have the same issue as well when trying to create a smart campaign setting

    const req = SmartCampaignSetting.create({
      campaign: campaignResourceName,
      phone_number: {
        country_code: request.campaign.prefix,
        phone_number: request.campaign.phone_number,
      },
      advertising_language_code: request.targeting.advertisement_language,
      final_url: 'https://www.example.com',
      business_name: 'Lorem ipsum',
    });

const response = await customer.mutateResources([
      {
        entity: 'smart_campaign_setting',
        operation: 'create',
        resource: req,
      },
    ]);

@hcyildirim @KirillPerepelitsa did you find the root cause for this type of error?