I am trying to add campaign targets using java client library but getting below error while adding device targets.I followed the approach mentioned in Google Ads API examples
Request
-------
MethodName: google.ads.googleads.v2.services.CampaignCriterionService/MutateCampaignCriteria
Endpoint:
googleads.googleapis.com:443Headers: {developer-token=TOKEN, login-customer-id=xxxxxxxxxx, x-goog-api-client=gl-java/1.8.0_201 gapic/ gax/1.45.0 grpc/1.21.0}
Body: customer_id: "yyyyyyyyyy"
operations {
create {
campaign {
value: "customers/yyyyyyyyyy/campaigns/aaaaaaaaaa"
}
criterion_id {
value: 30001
}
negative {
}
device {
type: MOBILE
}
bid_modifier {
value: 4.5
}
}
}
operations {
create {
campaign {
value: "customers/yyyyyyyyyy/campaigns/aaaaaaaaaa"
}
negative {
}
bid_modifier {
value: 3.4
}
proximity {
geo_point {
longitude_in_micro_degrees {
value: -178337050
}
latitude_in_micro_degrees {
value: 28422800
}
}
radius {
value: 10.0
}
radius_units: KILOMETERS
}
}
}
operations {
create {
campaign {
value: "customers/yyyyyyyyyy/campaigns/aaaaaaaaaa"
}
criterion_id {
value: 21132
}
negative {
}
location {
geo_target_constant {
value: "geoTargetConstants/21132"
}
}
bid_modifier {
value: 2.3
}
}
}
operations {
create {
campaign {
value: "customers/yyyyyyyyyy/campaigns/aaaaaaaaaa"
}
criterion_id {
value: 21133
}
negative {
}
location {
geo_target_constant {
value: "geoTargetConstants/21133"
}
}
bid_modifier {
value: 1.2
}
}
}
partial_failure: true
Response
--------
Headers: Metadata(content-disposition=attachment,content-type=application/grpc,request-id=7Cs-1xvq5XYUgPAj4vQ4jA,date=Fri, 30 Aug 2019 10:09:06 GMT,alt-svc=quic=":443"; ma=2592000; v="46,43,39")
Body: results {
}
results {
resource_name: "customers/yyyyyyyyyy/campaignCriteria/aaaaaaaaaa~810693935922"
}
results {
resource_name: "customers/yyyyyyyyyy/campaignCriteria/aaaaaaaaaa~21132"
}
results {
resource_name: "customers/yyyyyyyyyy/campaignCriteria/aaaaaaaaaa~21133"
}
partial_failure_error {
code: 3
message: "This operator cannot be applied to a criterion of this type., at operations[0].create.device" details {
type_url: "
type.googleapis.com/google.ads.googleads.v2.errors.GoogleAdsFailure"
value: "\nm\n\003\350\001\t\022<
This operator cannot be applied to a criterion of this type.\032\002*\000\"$\022\016\n\noperations\022\000\022\b\n\006create\022\b\n\006device"
}
}
Failure message: null
Status: Status{code=OK, description=null, cause=null}.
2019-08-30 10:09:08,867 [main] INFO c.t.s.c.g.i.s.CampaignTargetServiceClient - Add campaign targets operation 0 failed for account yyyyyyyyyy with errors: [error_code {
campaign_criterion_error:
OPERATOR_NOT_SUPPORTED_FOR_CRITERION_TYPE}
message: "This operator cannot be applied to a criterion of this type."
trigger {
string_value: ""
}
location {
field_path_elements {
field_name: "
operations"
index {
}
}
field_path_elements {
field_name: "
create"
}
field_path_elements {
field_name: "
device"
}
}
]