Opteo / google-ads-api

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

OPERATION_NOT_PERMITTED_FOR_REMOVED_RESOURCE #473

Open mymapdotworld opened 1 year ago

mymapdotworld commented 1 year ago

I'm trying to add, remove blocked ip criterions,

i tested my request with deliberately false criterion_id's (when removing) or invalid ip addresses, when adding

google's api correctly tells me that the criterion doesn't exist, or the ip is invalid

so, that brings me to the conclusion that i'm doing things right, and when i do, i get the "OPERATION_NOT_PERMITTED_FOR_REMOVED_RESOURCE" error

is this a misnomer, and it means i just don't have enough access rights ?

this is my code: `const {ResourceNames} = require("google-ads-api")

const criterion = ResourceNames.campaignCriterion(customer_id, this.campaign_id, criterion_id) await customer.campaignCriteria.remove([criterion])`

and async blockIP(address) { const customer = this.customer return await customer.campaignCriteria.create( [ { campaign: ResourceNames.campaign(customer.credentials.customer_id, this.id), type: enums.CriterionType.IP_BLOCK, ip_block: { ip_address: address }, negative: true, }, ], { response_content_type: "MUTABLE_RESOURCE", } ) }

(where "this" is an object that represents a campaign in my module,with the id, and the name of the campaign