Hi, 

*I have an account that informed: *
```
errors":[{"errorCode":{"resourceCountLimitExceededError":"RESOURCE_LIMIT"},"message":"This
 
request would exceed a limit on the number of allowed resources. The 
details of which type of limit was exceeded will eventually be returned in 
ErrorDetails.","trigger":{"stringValue":"LIMITED_LABELS_PER_TYPE_PER_CUSTOMER"},
```
*so I wrote a script to delete some labels, however, when I run the script 
I get another error:*
```
Failure: 
{"errors":[{"errorCode":{"internalError":"INTERNAL_ERROR"},"message":"An 
internal error has occurred."}]
```


*The request looks something like:*```
{"customerId":"REDACTED","operations":[{"remove":"customers/REDACTED/labels/REDACTED"},
 
...]
```

*the php code generating this output is here, and it is well-formed, and 
works otherwise:*
```
        $operations = [];

        $updateLabel = function(
            String $resourceName
        ) use(&$operations) {


            $labelOperation = new LabelOperation();
            $labelOperation->setRemove($resourceName);
            $operations[] = $labelOperation;

        };

        $query =
            "SELECT
                label.id,
                label.resource_name,
                label.status,
                label.name,
                ad_group.status
            FROM ad_group_label
            WHERE label.status != 'REMOVED'
            AND ad_group.status NOT IN ('REMOVED', 'PAUSED')";

        $labelExistsResponse = $this->search($query);

        $active = [];

        foreach (
            $labelExistsResponse->iterateAllElements()
            as $googleAdsRow
        ) {

            $label = $googleAdsRow->getLabel();
            $labelResourceName = $label->getResourceName();
            $labelName = $label->getName();
            $active[$labelResourceName] = $labelName;

        }

        $active = array_keys($active);

        $query =
            "SELECT
                label.id,
                label.resource_name,
                label.status,
                label.name,
                ad_group.status
            FROM ad_group_label
            WHERE label.status != 'REMOVED'";


        $labelExistsResponse = $this->search($query);

        $remove = [];

        foreach (
            $labelExistsResponse->iterateAllElements()
            as $googleAdsRow
        ) {

            $label = $googleAdsRow->getLabel();
            $labelResourceName = $label->getResourceName();
            $labelName = $label->getName();

            if (
                !in_array($labelResourceName, $active)
            ) {
                $remove[$labelResourceName] = $labelName;
            }

        }

        foreach(
            $remove as $resourceName => $name
        ) {
            $updateLabel(
                $resourceName
            );
        }

        if (
            $operations
        ) {

            // Issues a mutate request to update the ad group.
            $response =
                $this->googleAdsClient
                    ->getLabelServiceClient()
                    ->mutateLabels(
                        $this->clientId,
                        $operations
                    );

            $updatedLabels = $response->getResults()->count();

        }
```

Can you inform me what the internal error is? Thanks in advance! I can send 
you the error log if needed.

Shawn

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/70b1b02d-18a0-4d49-8e53-95806bf572f7n%40googlegroups.com.
  • re... Shawn Naquin
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
      • ... Shawn Naquin
        • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to