NEGATIVE_BEHAVIOR not supported on Batch Targeting Criteria Endpoint

targeting

#1

We are working on fully implementing the batch targeting endpoint for all targets, however we’re seeing an error when attempting to create a negative behavior target:

Your request (POST https://ads-api.twitter.com/1/batch/accounts/xxxxxx/targeting_criteria) resulted in the following errors: INVALID_PARAMETER: Expected valid targeting type, got “NEGATIVE_BEHAVIOR” for targeting_type

Is this a bug or is the NEGATIVE_BEHAVIOR target not yet supported through batch?


Ads API Version 3
#2

For reference, here is the json that was sent for this request:

{“operation_type”=>“Create”, “params”=>{“line_item_id”=>“8nji1”, “targeting_type”=>“NEGATIVE_BEHAVIOR”, “targeting_value”=>“lg41”}}


#3

Thanks for the question, @pakrouse. Great to hear that you and your team are implementing batch!

In order to set negative behavior targeting with the POST batch/accounts/:account_id/targeting_criteria endpoint, you’ll need to use the operator_type param with a value of NE. Because of this, the targeting type should be BEHAVIOR. Please see the following example.

$ twurl -H ads-api.twitter.com -X POST -A "Content-Type: application/json" -d '[{"operation_type":"Create","params":{"line_item_id":"8nszp","targeting_type":"BEHAVIOR","targeting_value":"lfsb", "operator_type":"NE"}}]' "/1/batch/accounts/18ce54d4x5t/targeting_criteria" | jq
{
  "data_type": "targeting_criterion",
  "data": [
    {
      "line_item_id": "8nszp",
      "name": "Partner audience targeting",
      "id": "ddut94",
      "operator_type": "NE",
      "created_at": "2017-05-05T15:25:18Z",
      "targeting_value": "lfsb",
      "updated_at": "2017-05-05T15:25:18Z",
      "deleted": false,
      "targeting_type": "BEHAVIOR"
    }
  ],
  "request": [
    {
      "params": {
        "line_item_id": "8nszp",
        "account_id": "18ce54d4x5t",
        "operator_type": "NE",
        "targeting_value": "lfsb",
        "targeting_type": "BEHAVIOR"
      },
      "operation_type": "Create"
    }
  ]
}

For an example with keywords, see this post.

I realize this isn’t well documented. We’ll work on making this clearer. Thanks again!


#4

Thanks @juanshishido! It would definitely be helpful if this was in the documentation


#5

Yeah it was doubly confusing for me since the POST accounts/:account_id/targeting_criteria documentation lists “NEGATIVE_BEHAVIOR” as a valid targeting type.

Please update the docs to explain the operator_type!