Google AdWords API: RequiredError.REQUIRED, operations[0].operand.criterion.parentCriterionId, and PRODUCT_PARTITION_DOES_NOT_EXIST

112 views
Skip to first unread message

gagan gupta

unread,
Apr 30, 2020, 7:58:17 AM4/30/20
to AdWords API and Google Ads API Forum
Hi,

I have tried creating a Product Partition which includes products based upon CUSTOM_ATTRIBUTE_0 with some values and keeps everything else as Excluded.

Sample Google Adwords UI Screenshot attached, which I am trying to mimic in APIs.
Attached is the code as well.

I am getting below errors while doing so.

RequiredError
{
apiErrorType=RequiredError, errorString=RequiredError.REQUIRED, fieldPath=operations[0].operand.criterion.parentCriterionId, fieldPathElements=[FieldPathElement{field=operations, index=0}, FieldPathElement{field=operand}, FieldPathElement{field=criterion}, FieldPathElement{field=parentCriterionId}], reason=REQUIRED, trigger=
}

AdGroupCriterionError
{
apiErrorType=AdGroupCriterionError, errorString=AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST, fieldPath=operations[1].operand.criterion.parentCriterionId, fieldPathElements=[FieldPathElement{field=operations, index=1}, FieldPathElement{field=operand}, FieldPathElement{field=criterion}, FieldPathElement{field=parentCriterionId}], reason=PRODUCT_PARTITION_DOES_NOT_EXIST, trigger=TempCriterionId{id=1872637}
}

AdGroupCriterionError
{
apiErrorType=AdGroupCriterionError, errorString=AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST, fieldPath=operations[2].operand.criterion.parentCriterionId, fieldPathElements=[FieldPathElement{field=operations, index=2}, FieldPathElement{field=operand}, FieldPathElement{field=criterion}, FieldPathElement{field=parentCriterionId}], reason=PRODUCT_PARTITION_DOES_NOT_EXIST, trigger=TempCriterionId{id=1872637}}


Gagan 

Screenshot from 2020-04-30 17-25-06.png
Screenshot from 2020-04-30 17-23-43.png
googleAdwordsAPIBug

Google Ads API Forum Advisor Prod

unread,
Apr 30, 2020, 3:15:32 PM4/30/20
to gagan...@gmail.com, adwor...@googlegroups.com

Hi Gagan,

Thank you for reaching out. In order for me to further investigate, could you please share the complete request and response logs and the complete source code via the Reply privately to author option?

Thanks and regards,
Xiaoming, Google Ads API Team



 

ref:_00D1U1174p._5001UaSxD8:ref

gagan gupta

unread,
May 1, 2020, 2:58:06 AM5/1/20
to AdWords API and Google Ads API Forum
Sure. Did That.

gagan gupta

unread,
May 1, 2020, 6:18:55 AM5/1/20
to AdWords API and Google Ads API Forum
May I expect a response, please.

Thanks.

Google Ads API Forum Advisor Prod

unread,
May 1, 2020, 1:13:41 PM5/1/20
to gagan...@gmail.com, adwor...@googlegroups.com

Hi Gagan,

Our team is looking into the issue you have. We will get back to you as soon as possible.



Thanks and regards,
Xiaoming, Google Ads API Team



 

ref:_00D1U1174p._5001UaSxD8:ref

Google Ads API Forum Advisor Prod

unread,
May 1, 2020, 4:20:36 PM5/1/20
to gagan...@gmail.com, adwor...@googlegroups.com
Hi,

Reading through your code, it appears that you are attempting to make the root node of the tree have a caseValue set to a dimension of type CUSTOM_ATTRIBUTE_0. However, the root node should not have a caseValue since it is meant to capture all products. To fix this, you could comment out the red portion of the code below. 

            // Create Main Parent parentProductPartition and Main Parent BiddableAdGroupCriterion
            ProductPartition parentProductPartition = new ProductPartition();
            parentProductPartition.setPartitionType(ProductPartitionType.SUBDIVISION);
            parentProductPartition.setId(-1L);

            ProductCustomAttribute parentProductDimension = new ProductCustomAttribute();
            parentProductDimension.setProductDimensionType("ProductCustomAttribute");
            parentProductDimension.setType(ProductDimensionType.CUSTOM_ATTRIBUTE_0);
            parentProductPartition.setCaseValue(parentProductDimension);


Another option would be to use the ProductPartitionTree utility offered in the client library , which simplifies the code you need to write to manage partition trees.

Thanks,
Josh, Google Ads API Team
 

ref:_00D1U1174p._5001UaSxD8:ref

gagan gupta

unread,
May 1, 2020, 6:18:45 PM5/1/20
to AdWords API and Google Ads API Forum
Thanks.
Yes, I tried First Approach already and realized that this gives an error:
PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE
This means an Empty correct case Value needs to be given.

The 2nd approach I want to try but the examples are poor in the documentation. My Body Panicked trying that :P 
Can you give documentation that can help me replicate the scenarios as same as I have written in code here?

Gagan

Google Ads API Forum Advisor Prod

unread,
May 1, 2020, 7:54:52 PM5/1/20
to gagan...@gmail.com, adwor...@googlegroups.com
Hi Gagan,

The PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE error will occur if the only node you create is the root node. If instead you create the root node (without a caseValue) and its children all in the same mutate request (as shown below), then the request should succeed.

            // Create Main Parent parentProductPartition and Main Parent BiddableAdGroupCriterion
            ProductPartition parentProductPartition = new ProductPartition();
            parentProductPartition.setPartitionType(ProductPartitionType.SUBDIVISION);
            parentProductPartition.setId(-1L);

            BiddableAdGroupCriterion parentBiddableAdGroupCriterion = new BiddableAdGroupCriterion();
            parentBiddableAdGroupCriterion.setCriterion(parentProductPartition);
            parentBiddableAdGroupCriterion.setAdGroupId(Long.parseLong(adGroupID));
            parentBiddableAdGroupCriterion.setUserStatus(UserStatus.PAUSED);
            parentBiddableAdGroupCriterion.setCriterionUse(CriterionUse.BIDDABLE);

            // Create child BiddableAdGroupCriterion and Child ProductPartition on CUSTOM_ATTRIBUTE_0
            ProductPartition childProductPartition = new ProductPartition();
            childProductPartition.setPartitionType(ProductPartitionType.UNIT);
            childProductPartition.setParentCriterionId(parentProductPartition.getId());

            ProductCustomAttribute productDimension1 = new ProductCustomAttribute();
            productDimension1.setProductDimensionType("ProductCustomAttribute");
            productDimension1.setType(ProductDimensionType.CUSTOM_ATTRIBUTE_0);
            productDimension1.setValue("auto-high10");
            childProductPartition.setCaseValue(productDimension1);

            BiddableAdGroupCriterion childBiddableAdGroupCriterion = new BiddableAdGroupCriterion();
            childBiddableAdGroupCriterion.setCriterion(childProductPartition);
            childBiddableAdGroupCriterion.setAdGroupId(Long.parseLong(adGroupID));
            childBiddableAdGroupCriterion.setUserStatus(UserStatus.ENABLED);
            childBiddableAdGroupCriterion.setCriterionUse(CriterionUse.BIDDABLE);

            // Create child NegativeAdGroupCriterion and Child ProductPartition on CUSTOM_ATTRIBUTE_0
            ProductPartition childNegativeProductPartition = new ProductPartition();
            childNegativeProductPartition.setPartitionType(ProductPartitionType.UNIT);
            childNegativeProductPartition.setParentCriterionId(parentProductPartition.getId());

            ProductCustomAttribute productDimension2 = new ProductCustomAttribute();
            productDimension2.setProductDimensionType("ProductCustomAttribute");
            productDimension2.setType(ProductDimensionType.CUSTOM_ATTRIBUTE_0);
            childNegativeProductPartition.setCaseValue(productDimension2);

            NegativeAdGroupCriterion childNegativeAdGroupCriterion = new NegativeAdGroupCriterion();
            childNegativeAdGroupCriterion.setCriterion(childNegativeProductPartition);
            childNegativeAdGroupCriterion.setAdGroupId(Long.parseLong(adGroupID));
            childNegativeAdGroupCriterion.setCriterionUse(CriterionUse.NEGATIVE);

            // Set Operation
            AdGroupCriterionOperation parentAdGroupCriterionOperation = new AdGroupCriterionOperation();
            parentAdGroupCriterionOperation.setOperand(parentBiddableAdGroupCriterion);
            parentAdGroupCriterionOperation.setOperator(Operator.ADD);

            AdGroupCriterionOperation child1AdGroupCriterionOperation = new AdGroupCriterionOperation();
            child1AdGroupCriterionOperation.setOperand(childNegativeAdGroupCriterion);
            child1AdGroupCriterionOperation.setOperator(Operator.ADD);

            AdGroupCriterionOperation child2AdGroupCriterionOperation = new AdGroupCriterionOperation();
            child2AdGroupCriterionOperation.setOperand(childBiddableAdGroupCriterion);
            child2AdGroupCriterionOperation.setOperator(Operator.ADD);

            AdGroupCriterionServiceInterface adGroupCriterionService =
                    adWordsServices.get(session, AdGroupCriterionServiceInterface.class);

            AdGroupCriterionReturnValue adGroupCriterionReturnValue = adGroupCriterionService.mutate(
                    new AdGroupCriterionOperation[]{parentAdGroupCriterionOperation, child1AdGroupCriterionOperation, child2AdGroupCriterionOperation});

gagan gupta

unread,
May 4, 2020, 4:10:01 AM5/4/20
to AdWords API and Google Ads API Forum
Wonderful and Respectful, this worked for now :)

Now I want to create one more level of SubDivision on the same.

For example:
1. Split childBiddableAdGroupCriterion into 2 Units again, one will have CUSTOM_ATTRIBUTE_1 as "someValue2" and Everything Else.
This Means I want All products which have  CUSTOM_ATTRIBUTE_1 as "someValue2" AND CUSTOM_ATTRIBUTE_0 as "someValue1"

OR 
2. Split childNegativeAdGroupCriterion into 2 Units again, one will have CUSTOM_ATTRIBUTE_1 as "someValue" and Everything Else.
This Means I want All products which have  CUSTOM_ATTRIBUTE_1 as "someValue2" AND does not have CUSTOM_ATTRIBUTE_0 as "someValue1"

3. How to do above Operations in this campaign by replacing Whole Product Partition Entities with Entirely new Product Partition Entities.

Google Ads API Forum Advisor Prod

unread,
May 4, 2020, 4:23:42 PM5/4/20
to gagan...@gmail.com, adwor...@googlegroups.com
Hi,

To convert a UNIT (leaf) node to a SUBDIVISION, you need to have the following operations in the same request:
  1. Remove the existing UNIT node.
  2. Add a new SUBDIVISION node.
  3. Add child UNIT nodes of the new SUBDIVISION node.
Please see this section of the Shopping campaigns guide .

gagan gupta

unread,
May 5, 2020, 2:22:33 AM5/5/20
to AdWords API and Google Ads API Forum
Ok, I will try this.
One Suggestion: You can implement Facade Design Patterns to hide complexity and expose the simple Facade to End User.
I this way, not all product partition complexity will be exposed to end-user, you can create a wrapper on top of this, and end-user will see a simple facade that is easy to use by reading documentation quickly.
Facebook Product ser creation is very simple:
There we can mention directly in JSON what conditions we need for example: 

Check out this link:

Regards,
Gagan

Google Ads API Forum Advisor Prod

unread,
May 5, 2020, 9:20:35 AM5/5/20
to gagan...@gmail.com, adwor...@googlegroups.com
Hi Gagan,

Thank you for the suggestion. The Shopping product partition utility I mentioned earlier was designed with similar goals in mind, as it provides a tree facade over the product partition criteria so users can just work with the tree structure and then have the utility generate the required operations . You may want to give that a try since you're using Java.

gagan gupta

unread,
May 6, 2020, 8:23:46 AM5/6/20
to AdWords API and Google Ads API Forum
Believe me, this is the most confusing documentation I have ever seen.

I have No idea what this is suggesting.
Especially this part "Sample use case":
The tasks mentioned and examples mentioned are not at all in sync.
Task: node from $2.50 to $2.00.
Example: ROOT
      ProductType Level1 shoes
        ProductType Level2 athletic shoes
          Condition new $2.50
          Condition used $1.00
          Other - exclude from bidding
        ProductType Level2 walking shoes
          Condition new $3.50
          Condition used $1.25
          Other $1.00
I searched other documents and could not find a satisfactory document.
I do not want to fall in the trap of Hit and Trial, the document shall help a Beginner.

Regards,
Gagan 

gagan gupta

unread,
May 6, 2020, 8:33:22 AM5/6/20
to AdWords API and Google Ads API Forum
And why are you still using the SOAP and SDKs, when you can easily expose it over the JSON formattable REST APIs with OAuth tokens.
1. In this way, you guys will not need to manage every SDK in different language.
2. You can easily use Spring Boot or similar tools to do the same.

In the end just keep it as simple as :
Check "Example Filter Rules" in the above document.

and return the Unique error strings related to the Unique type of error and expose a document again on all error types.
Remember: "Being Einstein may be challenging, but teaching relativity theory to a 5-year-old child, is the real deal!", we shall always keep things simple and easy to use for end-user.

Regards,
Gagan

Google Ads API Forum Advisor Prod

unread,
May 6, 2020, 2:00:07 PM5/6/20
to gagan...@gmail.com, adwor...@googlegroups.com
Hi Gagan,

Regarding your most recent reply, the Google Ads API (currently in beta) provides both gRPC/protobuf and REST/JSON endpoints, so we are taking steps in the direction you mentioned.

I realize that maintaining product partitions can be challenging since the nodes in the tree are returned as AdGroupCriterion objects, and you need to construct a tree from them on the client side using the criteria's id  and parentCriterionId . This is why we created the utility I mentioned. We're also considering ways to make this easier in the Google Ads API.

In the meantime, could you let me know specifically where you're currently having trouble?

gagan gupta

unread,
May 7, 2020, 1:19:34 AM5/7/20
to AdWords API and Google Ads API Forum
Thanks, Josh,

I am having trouble that the documentation is not easy to follow and examples that are mentioned in the documentation does not explain it cleanly.
For example, I want to achieve the following, which I am unable to and falling into the Hit and trials, as discussed earlier:

Now I want to create one more level of SubDivision on the same.

For example:
1. Split childBiddableAdGroupCriterion into 2 Units again, one will have CUSTOM_ATTRIBUTE_1 as "someValue2" and Everything Else.
This Means I want All products which have  CUSTOM_ATTRIBUTE_1 as "someValue2" AND CUSTOM_ATTRIBUTE_0 as "someValue1"

OR 
2. Split childNegativeAdGroupCriterion into 2 Units again, one will have CUSTOM_ATTRIBUTE_1 as "someValue" and Everything Else.
This Means I want All products which have  CUSTOM_ATTRIBUTE_1 as "someValue2" AND does not have CUSTOM_ATTRIBUTE_0 as "someValue1"

3. How to do above Operations in this campaign by replacing Whole Product Partition Entities with Entirely new Product Partition Entities.

Gagan

Google Ads API Forum Advisor Prod

unread,
May 7, 2020, 4:35:02 PM5/7/20
to gagan...@gmail.com, adwor...@googlegroups.com
Hi Gagan,

Sorry to hear that the documentation isn't providing the info you need. I've replied below inline on the 3 cases you mentioned.


Now I want to create one more level of SubDivision on the same.

For example:
1. Split childBiddableAdGroupCriterion into 2 Units again, one will have CUSTOM_ATTRIBUTE_1 as "someValue2" and Everything Else.
This Means I want All products which have  CUSTOM_ATTRIBUTE_1 as "someValue2" AND CUSTOM_ATTRIBUTE_0 as "someValue1"

In a single request, submit the following operations:
  1. Remove the existing childBiddableAdGroupCriterion UNIT node.
  2. Add a new SUBDIVISION node with a criterion.id=-1 and criterion.parentCriterionId set to the criterion.parentCriterionId of the removed node above.
  3. Add 2 child UNIT nodes of the new SUBDIVISION node, each with criterion.parentCriterionId to -1. Both will have a caseValue that's a ProductCustomAttribute  with type=CUSTOM_ATTRIBUTE_1. One should have value="someValue", and the other should leave value null (for "Everything else").
OR 
2. Split childNegativeAdGroupCriterion into 2 Units again, one will have CUSTOM_ATTRIBUTE_1 as "someValue" and Everything Else.
This Means I want All products which have  CUSTOM_ATTRIBUTE_1 as "someValue2" AND does not have CUSTOM_ATTRIBUTE_0 as "someValue1"

This is similar to #1. Just make sure that when you add the new SUBDIVISION node to replace the negative criterion, you add it as a BiddableAdGroupCriterion. You cannot have a SUBDIVISION that is a NegativeAdGroupCriterion, since a negative criterion excludes all products that fall under its ProductPartition case value.
 
3. How to do above Operations in this campaign by replacing Whole Product Partition Entities with Entirely new Product Partition Entities.

If you want to replace the entire tree, you can remove the root AdGroupCriterion, which is the one with criterion.parentCriterionId=null. Then you can issue operations that add all of the nodes of the tree as desired. The removal of the root and the subsequent operations can all be submitted in the same mutate request.

One tip: to get comfortable with the structure of the tree and how it's reflected in the API, I find it's helpful to modify the tree in the UI in various ways on a test ad group, and then issue an AdGroupCriterionService.get() to retrieve the resulting criteria. This should cut down on trial and error when you implement the equivalent actions using the API.


Thanks,
Josh, Google Ads API Team


ref:_00D1U1174p._5001UaSxD8:ref

gagan gupta

unread,
May 8, 2020, 7:54:06 AM5/8/20
to AdWords API and Google Ads API Forum
Thanks.

I want to Achieve:
1. Product Partition as : All Products except filters on Product_Type_L1 and except filters on CUSTOM_LABEL_0
I tried with Attcahed code and got Attched Errors.

2. In Same code please add code which can remove all existing product partitions first and send the coded structure for creating partitions.

Gagan 
GoogleProductPartition
Errors

Google Ads API Forum Advisor Prod

unread,
May 8, 2020, 4:41:18 PM5/8/20
to gagan...@gmail.com, adwor...@googlegroups.com
Hi Gagan,

Perhaps you can use the Java client library and its associated code example ? It provides a utility class that abstracts the partition tree complexity. You can see its source code here.

Cheers
Anash

ref:_00D1U1174p._5001UaSxD8:ref

gagan gupta

unread,
May 13, 2020, 4:13:38 AM5/13/20
to AdWords API and Google Ads API Forum
Unable to open link in "associated code example "

gagan gupta

unread,
May 14, 2020, 1:17:04 AM5/14/20
to AdWords API and Google Ads API Forum
Hi Anash,

Thanks.
1. Unable to open link in "associated code example ", shows error.
2. I tried fetching the data for existing Campaigns Created via UI, but I do not get a Tree anywhere, it only gives Criteria and has only Criteria IDs.
3. How to remove and add new nodes in the same request. Code, please.

Regards,
Gagan 

Google Ads API Forum Advisor Prod

unread,
May 21, 2020, 3:27:32 PM5/21/20
to gagan...@gmail.com, adwor...@googlegroups.com
Hi Gagan,

I'll share the example link again: https://github.com/googleads/googleads-java-lib/blob/master/examples/adwords_axis/src/main/java/adwords/axis/v201809/shoppingcampaigns/AddProductPartitionTree.java

The tree is a feature that the Java client library provides. The underlying API only gives you a list of criteria, corresponding to each node of the partition tree.
Reply all
Reply to author
Forward
0 new messages