IpBlockInfo

175 views
Skip to first unread message

Harikesh Kumar

unread,
Oct 24, 2021, 8:06:00 AM10/24/21
to AdWords API and Google Ads API Forum
Hi 

I have used v8 and I want to try to block  IP Addresses. (use Google\Ads\GoogleAds\V8\Services\CustomerClientLinkOperation;

Here is my code. 
use Google\Protobuf\BoolValue;
use Google\Protobuf\StringValue;
use Google\Protobuf\Int64Value;
use Google\Protobuf\EnumValue;
use Google\Protobuf\DoubleValue;
use Google\ApiCore\ApiException; 

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

I'm getting this error 

code: 0
file: "/home/theclicksaver/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"


Thanks & regards
Harikesh Kumar

Google Ads API Forum Advisor

unread,
Oct 25, 2021, 5:07:05 AM10/25/21
to harikeshk...@gmail.com, adwor...@googlegroups.com
Hi Harikesh,

Thank you for reaching out to our API support team.

Could you confirm your use case for the Google\Ads\GoogleAds\V8\Services\CustomerClientLinkOperation? I asked because this should not be associated to using the IpBlock and targeting, and is related more to linking accounts.

Moving forward, could you try not setting the negative = true attribute? Specifying a value in the IpBlockInfo should already exclude that said address.

Should the issue persist, you may provide the complete request and response logs, with the request-id. Since you are using PHP, you can enable logging by referring to this guide.

You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2QEmPR:ref
Reply all
Reply to author
Forward
0 new messages