How can I delete PLATFORM_VERSION targeting?


#1

Hi,

I’m trying to delete PLATFORM_VERSION targeting but advertiser api returns error.
I’m using ‘/batch/accounts/:account_id/targeting_criteria’.

Here’s request and response.

Request:
{‘operation_type’: ‘Delete’, ‘params’: {‘targeting_value’: u’6’, ‘targeting_type’: ‘PLATFORM_VERSION’, ‘targeting_criterion_id’: u’9qidcz’, ‘operator_type’: ‘GTE’, ‘line_item_id’: u’61dpa’, ‘id’: u’9qidcz’}}, {‘operation_type’: ‘Delete’, ‘params’: {‘targeting_criterion_id’: u’9qiddc’, ‘line_item_id’: u’61dpa’, ‘targeting_value’: u’qoub’, ‘id’: u’9qiddc’, ‘targeting_type’: ‘APP_STORE_CATEGORY’}}, {‘operation_type’: ‘Delete’, ‘params’: {‘targeting_criterion_id’: u’9qiddd’, ‘line_item_id’: u’61dpa’, ‘targeting_value’: u’qoud’, ‘id’: u’9qiddd’, ‘targeting_type’: ‘APP_STORE_CATEGORY’}}, {‘operation_type’: ‘Delete’, ‘params’: {‘targeting_criterion_id’: u’9qidde’, ‘line_item_id’: u’61dpa’, ‘targeting_value’: u’qov0’, ‘id’: u’9qidde’, ‘targeting_type’: ‘APP_STORE_CATEGORY’}}, {‘operation_type’: ‘Delete’, ‘params’: {‘targeting_criterion_id’: u’9qiddf’, ‘line_item_id’: u’61dpa’, ‘targeting_value’: u’qouk’, ‘id’: u’9qiddf’, ‘targeting_type’: ‘APP_STORE_CATEGORY’}}, {‘operation_type’: ‘Delete’, ‘params’: {‘targeting_criterion_id’: u’9qiddg’, ‘line_item_id’: u’61dpa’, ‘targeting_value’: u’qoul’, ‘id’: u’9qiddg’, ‘targeting_type’: ‘APP_STORE_CATEGORY’}}, {‘operation_type’: ‘Delete’, ‘params’: {‘targeting_criterion_id’: u’9rmi17’, ‘line_item_id’: u’61dpa’, ‘targeting_value’: u’4q’, ‘id’: u’9rmi17’, ‘targeting_type’: ‘DEVICE’}}, {‘operation_type’: ‘Create’, ‘params’: {‘line_item_id’: u’61dpa’, ‘targeting_value’: u’1’, ‘targeting_type’: ‘PLATFORM’}}]

Response:
{u’request’: [{u’operation_type’: u’Delete’, u’params’: {u’targeting_criterion_id’: u’9qidcz’, u’account_id’: u’5lwgvc’}}, {u’operation_type’: u’Delete’, u’params’: {u’targeting_criterion_id’: u’9qiddc’, u’account_id’: u’5lwgvc’}}, {u’operation_type’: u’Delete’, u’params’: {u’targeting_criterion_id’: u’9qiddd’, u’account_id’: u’5lwgvc’}}, {u’operation_type’: u’Delete’, u’params’: {u’targeting_criterion_id’: u’9qidde’, u’account_id’: u’5lwgvc’}}, {u’operation_type’: u’Delete’, u’params’: {u’targeting_criterion_id’: u’9qiddf’, u’account_id’: u’5lwgvc’}}, {u’operation_type’: u’Delete’, u’params’: {u’targeting_criterion_id’: u’9qiddg’, u’account_id’: u’5lwgvc’}}, {u’operation_type’: u’Delete’, u’params’: {u’targeting_criterion_id’: u’9rmi17’, u’account_id’: u’5lwgvc’}}, {u’operation_type’: u’Create’, u’params’: {u’targeting_value’: 1, u’line_item_id’: u’61dpa’, u’account_id’: u’5lwgvc’, u’targeting_type’: u’PLATFORM’}}], u’operation_errors’: [[{u’message’: u’null was not found for Account 5lwgvc’, u’code’: u’NOT_FOUND’}], [], [], [], [], [], [], []]}

I can’t figure out meaning “null was not found for Account”.

I tried with ‘GTE’ and without ‘GTE’ but both returns same result.
Thanks,
Min


#2

Hi, @minwang129. Thanks for your question and for providing the request and response information—that’s really helpful!

The issue here is that 9qidcz has already been deleted. See:

$ twurl -H ads-api.twitter.com "/1/accounts/5lwgvc/targeting_criteria/9qidcz?with_deleted=true" | jq
{
  "request": {
    "params": {
      "targeting_criterion_id": "9qidcz",
      "account_id": "5lwgvc",
      "with_deleted": true
    }
  },
  "data_type": "targeting_criterion",
  "data": {
    "line_item_id": "61dpa",
    "name": "5.1",
    "id": "9qidcz",
    "account_id": "5lwgvc",
    "created_at": "2016-08-23T01:18:42Z",
    "targeting_value": "6",
    "updated_at": "2016-08-29T17:34:00Z",
    "deleted": true,
    "targeting_type": "PLATFORM_VERSION"
  }
}

This causes the batch request to fail. Also note that:

Batch requests fail or succeed together as a group and all API responses for both error and success preserve the item order of the initial request.

This is how I was able to isolate that the issue was with 9qidcz. When there is an error, no data is returned (the response arrays are empty) for the other requests.

So, try removing that first object in your request. (As a side note, not completely sure the request was constructed properly because the response references "null was not found." Either way, see below for an example request.)

Also, for deleting targeting criteria using the batch endpoint, you only need to specify the line_item_id and targeting_criterion_id. Here is an example request using twurl:

$ twurl -H ads-api.twitter.com -A "Content-Type: application/json" -X POST -d '[{"operation_type":"Delete","params":{"targeting_criterion_id" : "aaaa", "line_item_id":"yyyyy"}},{"operation_type":"Delete","params":{"targeting_criterion_id" : "bbbb", "line_item_id":"yyyyy"}}]' "/1/batch/accounts/xxxxx/targeting_criteria"

Hope this helps! Please follow up and let us know whether this resolved the issue. Thanks!


#3

Hi @juanshishid,
Thanks for your reply.

I deleted 9qidcz targeting using another api yesterday and that caused the batch request to fail.

I’ve tried with new PLATFORM_VERSION targeting but I got same error message.
Here’s twurl command I’ve used.

twurl -t -H ads-api.twitter.com -A “Content-Type: application/json” -X POST -d ‘[{“operation_type”:“Delete”,“params”:{“targeting_criterion_id” : “9qidce”, “line_item_id”:“61dp9”}}]’ “/1/batch/accounts/5lwgvc/targeting_criteria” | python -m json.tool

Response:
{
“operation_errors”: [
[
{
“code”: “NOT_FOUND”,
“message”: “null was not found for Account 5lwgvc”
}
]
],
“request”: [
{
“operation_type”: “Delete”,
“params”: {
“account_id”: “5lwgvc”,
“targeting_criterion_id”: “9qidce”
}
}
]
}

Could you take a look on this issue again?

Thanks!


#4

Thanks for the additional information, @minwang129! We have not been able to reproduce this on our accounts. We’ll continue looking, though! Thanks.


#5

@minwang129: It looks like this is a bug. So, thanks for bringing this to our attention! We don’t currently have a timeframe for when this might be fixed, but will update you once we know more.


#6

@minwang129: Unfortunately, we have not been able to reproduce this error. If it happens again, could you let us know and provide the timestamp of when it occurred? Thanks.