Hi,
I am trying to delete product groups on my account using Adwords 
API v201809. 
I keep getting UNEXPECTED_INTERNAL_API_ERROR and I am not able to tell what 
the error possible could be ? 
Any help is appreciate here. 




session.setClientCustomerId(accountId);
    String KEY_TO_EXTRACT_PRODUCT_TYPE = "value=";

    if (partitionTree == null) {
      partitionTree = ProductPartitionTree.createAdGroupTree(adWordsServices, 
session, adGroupId);
    }

    //get the root from the tree
    ProductPartitionNode root = partitionTree.getRoot();
    ProductPartitionNode subDivisionNode;
    // get root as subdivision as that is the actionable object
    String adwordsProductType = "";
    for (ProductPartitionNode node: root.getChildren()) {
      // We are trying to extract the correct product type on adwords. This is 
because there are times when
      // the product type in our SQL DB is different from that on adwords 
because of encoding issues. Example - (notice the difference in dash)
      // '[global] small electrics – body weight scales' (on adwords) and 
'[global] small electrics - body weight scales' (on SQL DB)
      if (node.getDimension().toString().contains(KEY_TO_EXTRACT_PRODUCT_TYPE)) 
{
        // this is to extract the product type value from a string like 
'ProductType{productDimensionType=ProductType, type=PRODUCT_TYPE_L1, 
value=[global] storage and org - [closet storage] baskets boxes & buckets}'
        adwordsProductType = 
node.getDimension().toString().substring(node.getDimension().toString().indexOf(KEY_TO_EXTRACT_PRODUCT_TYPE)
 + KEY_TO_EXTRACT_PRODUCT_TYPE.length());
        adwordsProductType = adwordsProductType.substring(0, 
adwordsProductType.indexOf('}'));
        break;
      }
    }

    root = root.asSubdivision();

    //adding or fetching the subdivision from the root
    if (!adwordsProductType.equals(productType)) {
      log.error(String.format("Product Type of ad groups was changed from %s to 
%s", productType, adwordsProductType));
      productType = adwordsProductType;
    }
    subDivisionNode =  
root.getChild(ProductDimensions.createType(PRODUCT_TYPE_L1, 
productType)).asSubdivision();

    ProductDimension itemProductDimenion = 
ProductDimensions.createOfferId(itemId);
    itemProductDimenion.setProductDimensionType(PRODUCT_OFFER_ID);
    // A check to ensure that the item id exists.
    if (!subDivisionNode.hasChild(itemProductDimenion)) {
      log.error(String.format("Missing: ItemId %s not found.\n", itemId));
      plasNotFound.add(recordId);
    } else {
        //adding the child node to the subdivision
        subDivisionNode.removeChild(itemProductDimenion);
      }
    }

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"AdWords API and Google Ads 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/331017ee-664a-4bd1-a08c-4e8bcf8f202b%40googlegroups.com.

Reply via email to