Having issue with IpBlockInfo in latest version of GAds API

Skip to first unread message

Mitiz Technologies

Nov 1, 2021, 3:51:52 AM11/1/21
Hi there,
We are using GAds API v8 in our application and we are facing problem while blocking IP address from the linked account. The accounts are linked successfully however if we are trying to block the IP address for any campaign using API, it throws error. Here is piece of code that we are using:

use Google\Protobuf\BoolValue;
use Google\Protobuf\StringValue;
use Google\Protobuf\Int64Value;
use Google\Protobuf\EnumValue;
use Google\Protobuf\DoubleValue;
use Google\ApiCore\ApiException;

$campaignResourceName = ResourceNames::forCampaign($adwords_user_id, $adwords_campaign_id);

$campaignCriterion = new CampaignCriterion([
'campaign' => new StringValue(['value' => $campaignResourceName]),
'type' => CriterionType::IP_BLOCK,
'ip_block' => new IpBlockInfo(['ip_address' => new StringValue(['value' => $ipAddress2])])

We are seeing the following error:
code: 0
file: "public_html/adwords/google-ads-php/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBUtil.php"
line: 96
message: "Expect string."
name: "Exception"
stack-trace: [,…]
type: "InvalidArgumentException"


Can you please look into this and suggest me to fix the issue? My Manager_Customer_Id is 9663159860.

Let me know if there is anything from my end.


Reply all
Reply to author
0 new messages