Expected Long got "Sport news" for targeting value

ads
api

#1

Hello i have been trying to post targeting_criteria for a line item, my targeting_type is “INTERESTS” and targgeting_value is “Sports/Auto racing” but i get
[ {
code: ‘INVALID_PARAMETER’,
message: ‘Expected Long, got “Sports/Auto racing” for targeting_value’,
parameter: ‘targeting_value’
} ]
each time i make this request. What is the best way to format this request.
My complete request is:

https://ads-api.twitter.com/1/accounts/18ce54g8im6/targeting_criteria?line_item_id={line_item_id}&targeting_type=INTERESTS&targeting_value=Sports/Auto%racing


#2

Hello! The reason you got that response is because targeting_value is expecting a numeric value.

If you run the command ->
twurl -H ads-api.twitter.com “/1/targeting_criteria/interests?q=sports/auto” | jq

The output will look like the following and you will notice targeting_value for “Sports/Auto racing” equals “20002” ->

{
  "data_type": "targeting_criterion",
  "data": [
    {
      "name": "Sports/Auto racing",
      "targeting_type": "INTEREST",
      "targeting_value": "20002"
    }
  ],
  "request": {
    "params": {
      "q": "sports/auto"
    }
  },
  "next_cursor": null
}