Campaign creation:
curl -X POST \
'
https://googleads.googleapis.com/v15/<CUSTOMER_RESSOURCE_NAME>/campaignCriteria:mutate' \
-H 'Content-Type: application/json' \
-H 'developer-token: <DEVELOPER_TOKEN>' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
-H 'login-customer-id: <MANAGER_ID>' \
-d '{
"operations": [
{
"create": {
"negative": false,
"campaign": "<CUSTOMER_RESSOURCE_NAME>/campaigns/21005342630",
"type": "GENDER",
"gender": {
"type": "FEMALE"
}
}
}
]
}'
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "
type.googleapis.com/google.ads.googleads.v15.errors.GoogleAdsFailure",
"errors": [
{
"errorCode": {
"criterionError": "FIELD_INCOMPATIBLE_WITH_NEGATIVE_TARGETING"
},
"message": "The field is not allowed to be set when the negative field is set to true, for example, we don't allow bids in negative ad group or campaign criteria.",
"location": {
"fieldPathElements": [
{
"fieldName": "operations",
"index": 0
},
{
"fieldName": "create"
},
{
"fieldName": "gender"
}
]
}
}
],
"requestId": "jex36XGZqBA5l1VJ6X2mgA"
}
]
}
}
Update Criteria (when created with negative define true):
curl -X POST \
'
https://googleads.googleapis.com/v15/<CUSTOMER_RESSOURCE_NAME>/campaignCriteria:mutate' \
-H 'Content-Type: application/json' \
-H 'developer-token: <DEVELOPER_TOKEN>' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
-H 'login-customer-id: <MANAGER_ID>' \
-d '{
"operations": [
{
"updateMask": "gender.type",
"update": {
"negative": false,
"resourceName": "<CUSTOMER_RESSOURCE_NAME>/campaignCriteria/21005342630~10",
"gender": {
"type": "FEMALE"
}
}
}
]
}'
{
"results": [
{
"resourceName": "<CUSTOMER_RESSOURCE_NAME>/campaignCriteria/21005342630~10"
}
]
}
The response is positive but when i want to get the campaign criteria info using a GAQL, the criteria isn't update. Moreover negative isn't available in the updateMask field
Campaign data (Criteria):
"campaignCriterion":[{"campaignCriterion":{"resourceName":"<CUSTOMER_RESSOURCE_NAME>/campaignCriteria/21005342630~10","type":"GENDER","gender":{"type":"MALE"},"campaign":"<CUSTOMER_RESSOURCE_NAME>/campaigns/21005342630","criterionId":"10","negative":true}}, ... ],
Tell me if you need more information