Can't Set parentalStatus to AdGroupCriterion

209 views
Skip to first unread message

Shawn Hsiao

unread,
Jan 22, 2024, 3:59:32 AM1/22/24
to Google Ads API and AdWords API Forum
Hello,

When I was setting parentalStatus of AdGroupCriterion, I encountered an error `OPERATION_NOT_PERMITTED_FOR_CONTEXT`

  • Complete Error messages are as follows:

```
debug_error_string = "UNKNOWN:Error received from peer ipv4:142.251.42.234:443 {created_time:"2024-01-22T16:43:42.946377+08:00", grpc_status:3, grpc_message:"Request contains an invalid argument."}"
>, errors {
  error_code {
    context_error: OPERATION_NOT_PERMITTED_FOR_CONTEXT
  }
  message: "The operation is not allowed for the given context."
  trigger {
    string_value: "SEARCH(SEARCH_STANDARD)"
  }
  location {
    field_path_elements {
      field_name: "operations"
      index: 0
    }
    field_path_elements {
      field_name: "create"
    }
    field_path_elements {
      field_name: "parental_status"
    }
  }
}
request_id: "FzSWqMhAFGEUOZiZiRc0VA"
, 'FzSWqMhAFGEUOZiZiRc0VA')

```

  • My code was below:
```
def main(client, customer_id, ad_group_id):
    ad_group_service = client.get_service("AdGroupService")
    ad_group_criterion_service = client.get_service("AdGroupCriterionService")
    ad_group_resource_name = ad_group_service.ad_group_path(customer_id, ad_group_id)

    # Exclude Parent
    parent_operation = client.get_type("AdGroupCriterionOperation")
    parent_criterion = parent_operation.create
    parent_criterion.ad_group = ad_group_resource_name
    parent_criterion.negative = True
    parent_criterion.parental_status.type_ = client.enums.ParentalStatusTypeEnum.PARENT

    ad_group_criterion_response = ad_group_criterion_service.mutate_ad_group_criteria(
        customer_id=customer_id,
        operations=[
            parent_operation
        ],
    )

    for result in ad_group_criterion_response.results:
        print(f"Created criterion {result.resource_name}.")


if __name__ == "__main__":
    client = get_client()
    CUSTOMER_ID = "5692452448"
    ad_group_id = "163236537532"
    main(client, CUSTOMER_ID, ad_group_id)
```

I had successfully modified criterion with income_range, gender, and age, but `parentalStatus` was not the case. Please assist with how to correct the error, thanks in advance.

Google Ads API Forum Advisor

unread,
Jan 22, 2024, 4:56:23 AM1/22/24
to shawn...@koodata.com.tw, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

By reviewing your concern, I understand that you are getting an error message "OPERATION_NOT_PERMITTED_FOR_CONTEXT" while setting parentalStatus of AdGroupCriterion.
Upon checking, I understand you have provided the error logs but kindly note that error logs are not sufficient to investigate the issue so please provide us complete API logs (request and response with request-id and request header) generated at your end and uncropped UI screenshot of the Google Ads account where you are facing the issue.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02rXugI:ref"

Thanks,
 
Google Logo Google Ads API Team


Shawn Hsiao

unread,
Jan 22, 2024, 6:07:11 AM1/22/24
to Google Ads API and AdWords API Forum
Plus, I was using the google ads library of google-ads-python to fetch client object, and it was not the cause of failing the create operation.

Google Ads API Forum Advisor

unread,
Jan 22, 2024, 9:30:02 AM1/22/24
to shawn...@koodata.com.tw, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

I would like to inform you that the provided error logs are not sufficient to investigate your issue further. So, I request that you kindly provide us with the earlier requested complete API logs (request and response with request-id and request header) generated at your end to assist you further.

Shawn Hsiao

unread,
Jan 23, 2024, 6:07:44 AM1/23/24
to Google Ads API and AdWords API Forum
Hi, 

I had sent the requested info yesterday with `reply with author`, could you please check if you had received my email? thanks.

Google Ads API Forum Advisor

unread,
Jan 23, 2024, 8:58:28 AM1/23/24
to shawn...@koodata.com.tw, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

I have raised your concern with the rest of our team and one of my teammates will reach out to you once we have an update.

Google Ads API Forum Advisor

unread,
Jun 10, 2024, 12:59:28 PM6/10/24
to adwor...@googlegroups.com, shawn...@koodata.com.tw
Hi,

We have an update.

Kindly note that 'Parent' criterion is not allowed for 'SEARCH' campaigns.
 

This message is in relation to case "ref:!00D1U01174p.!5004Q02rXugI:ref" (ADR-00220089)


Thanks,
 
Google Logo Google Ads API Team

 



Reply all
Reply to author
Forward
0 new messages