Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't add Youtube channel to Campaign Placements - Mutates are not allowed #898

Open
dmitrys-svsgco opened this issue Dec 18, 2024 · 0 comments
Labels
bug Something isn't working triage New issue; requires attention

Comments

@dmitrys-svsgco
Copy link

dmitrys-svsgco commented Dec 18, 2024

Describe the bug:

When I try to add Youtube channel to Campaign Placements the following method fails
with "Mutates are not allowed for the requested resource"

Steps to Reproduce:

Use this method:

def add_youtube_channel_to_ad_group(client, customer_id, ad_group_id, channel_id):
    ad_group_criterion_service = client.get_service("AdGroupCriterionService")
    ad_group_service = client.get_service("AdGroupService")

    # Create a new AdGroupCriterion for the YouTube channel
    ad_group_criterion = client.get_type("AdGroupCriterion")
    # ad_group_criterion.ad_group = f"customers/{customer_id}/adGroups/{ad_group_id}"
    ad_group_criterion.ad_group = ad_group_service.ad_group_path(customer_id, ad_group_id)
    ad_group_criterion.status = client.get_type("AdGroupCriterionStatusEnum").ENABLED
    ad_group_criterion.negative = False
    ad_group_criterion.type_ = client.enums.CriterionTypeEnum.YOUTUBE_CHANNEL
    ad_group_criterion.youtube_channel.channel_id = channel_id

    ad_group_criterion_operation = client.get_type("AdGroupCriterionOperation")
    ad_group_criterion_operation.create.CopyFrom(ad_group_criterion)

    operations = [ad_group_criterion_operation]

    try:
        response = ad_group_criterion_service.mutate_ad_group_criteria(
            customer_id=customer_id, operations=operations
        )
        print(f"Added YouTube Channel criterion with ID: {channel_id} to Ad Group: {ad_group_id}")
    except GoogleAdsException as ex:
        print(ex)

Expected behavior:
I expect YouTube channel being added to Placements

Client library version and API version:
google-ads = "24.0.0"
google-api-core = "2.13.0"
google-api-python-client = "2.78.0"
google-auth = "2.15.0"
google-auth-httplib2 = "0.1.0"
google-auth-oauthlib = "1.0.0"

Request/Response Logs:

Method: /google.ads.googleads.v16.services.AdGroupCriterionService/MutateAdGroupCriteria
Host: googleads.googleapis.com
Headers: {
  "developer-token": "REDACTED",
  "x-goog-api-client": "gl-python/3.11.0rc1 grpc/1.62.2 gax/2.13.0 gccl/24.0.0 pb/4.25.5",
  "x-goog-request-params": "customer_id=94....92"
}
Request: customer_id: "94....92"
operations {
  create {
    status: ENABLED
    ad_group: "customers/94....92/adGroups/1...2"
    type_: YOUTUBE_CHANNEL
    negative: false
    youtube_channel {
      channel_id: "UCWZwfV3ICOt3uEPpW6hYK4g"
    }
  }
}


Response
-------
Headers: {
  "google.ads.googleads.v16.errors.googleadsfailure-bin": "\nT\n\u00028\t\u00123Mutates are not allowed for the requested resource.\u001a\u0007*\u0005VIDEO\"\u0010\u0012\u000e\n\noperations\u0018\u0000\u0012\u0016Hf7Ro1_Ps4tUbZW-TkYj-g",
  "grpc-status-details-bin": "\b\u0003\u0012%Request contains an invalid argument.\u001a\u0001\nDtype.googleapis.com/google.ads.googleads.v16.errors.GoogleAdsFailure\u0012n\nT\n\u00028\t\u00123Mutates are not allowed for the requested resource.\u001a\u0007*\u0005VIDEO\"\u0010\u0012\u000e\n\noperations\u0018\u0000\u0012\u0016Hf7Ro1_Ps4tUbZW-TkYj-g",
  "request-id": "Hf7Ro1_Ps4tUbZW-TkYj-g"
}
Fault: errors {
  error_code {
    mutate_error: MUTATE_NOT_ALLOWED
  }
  message: "Mutates are not allowed for the requested resource."
  trigger {
    string_value: "VIDEO"
  }
  location {
    field_path_elements {
      field_name: "operations"
      index: 0
    }
  }
}
request_id: "Hf7Ro1_Ps4tUbZW-TkYj-g"
@dmitrys-svsgco dmitrys-svsgco added bug Something isn't working triage New issue; requires attention labels Dec 18, 2024
@dmitrys-svsgco dmitrys-svsgco changed the title Add Youtube channel to Campaign fails Add Youtube channel to Campaign Placements fails Dec 18, 2024
@dmitrys-svsgco dmitrys-svsgco changed the title Add Youtube channel to Campaign Placements fails Can't add Youtube channel to Campaign Placements - Mutates are not allowed Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New issue; requires attention
Projects
None yet
Development

No branches or pull requests

1 participant