Hi,

I'm experiencing difficulties with the creation of ad group criteria.
After creating ad groups, I want to create an ad group criterion for each 
(see object below), but I keep getting the FieldError "The required field 
was not present",
caused by the *parent_ad_group_criterion *property
(under *listing_group*). This is weird, because I am specifying it as null, 
which is allowed according to the documentation,
which states: "Resource name of ad group criterion which is the parent 
listing group subdivision. Null for the root group."

I am working in a Node.js environment and I have tried the result in two 
ways, with the same result each time:

   - Through the REST API, POST-request with axios (see request details 
   below)
   - Through the Opteo library for Node.js

It works without auth errors, just doesn't execute the creations.
I tried various things like replacing null with an empty string (''), 
leaving it out altogether, nothing worked. 

*POST REQUEST*

*POST /v9/customers/${accountId}/adGroupCriteria:mutate HTTP/1.1*

*Body*:
{
    operations: [
        {
              create: {
                  ad_group: 'customers/${customerId}/adGroups/${adGroupId}',
                  cpc_bid_micros: 200000,
                  listing_group: {
                      parent_ad_group_criterion: null,
                      case_value: {
                          product_item_id: { 
                              value: `${offerId}`,
                         },
                     },
                      type: 2
                 },
                  status: 2
            },
        },
    ],
}

*Headers*:
{
    "Authorization": 'Bearer ' + ${access_token},
    "developer-token": ${GOOGLE_ADS_DEVELOPER_TOKEN},
    "login-customer-id": ${manager_account_id},
}
*RESPONSE*
{
  code: 400,
  message: 'Request contains an invalid argument.',
  status: 'INVALID_ARGUMENT',
  details: [
    {
      '@type': 
'type.googleapis.com/google.ads.googleads.v9.errors.GoogleAdsFailure',
      errors: [Array],
      requestId: ' **removed** '
    }
  ]
}

*Error in errors array:*

[
  {
    errorCode: { fieldError: 'REQUIRED' },
    message: 'The required field was not present.',
    location: { fieldPathElements: [Array] }
  }
]

*Location object:*

{
  fieldPathElements: [
    { fieldName: 'operations', index: 0 },
    { fieldName: 'create' },
    { fieldName: 'listing_group' },
    { fieldName: 'parent_ad_group_criterion' }
  ]
}

Doing the same through Opteo looks like this, which yields the same error:
await customer.adGroupCriteria.create(
    [
        {
            ad_group: 'customers/${customerId}/adGroups/${adGroupId}',
            cpc_bid_micros: 200000,
            listing_group: {
                parent_ad_group_criterion: null,
                case_value: {
                    product_item_id: { 
                        value: `${offerId}`,
                    },
                },
                type: 2
            },
            status: 2
        }
    ],
    {
          partial_failure: true,
    },
);

I thought at first it was a problem with Opteo (e.g. a workaround was 
posted to fix the problem with their *update_mask*, which removed 
properties if they were set to *null*),
but the fact that the same error occurs through the REST API seems to 
disprove this. 

Does anyone have any idea what's going wrong? 
Thanks,
Thomas 

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/e2d3ef35-7564-4f23-9caa-83e089126f13n%40googlegroups.com.
  • Re... Thomas D'heer
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
      • ... Thomas D'heer
        • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to