Keyword targeting with emoji not working


#1

Hi,

I was trying to assign a keyword targeting with a emoji today and got a INVALID REQUEST exception:

<=== [2016-06-10 20:42:32 +0000 :: ovapjqkws :: 6zy9 :: 2325615391] twurl -H ads-api-sandbox.twitter.com -X POST -d “[{“operation_type”:“Create”,“params”:{“line_item_id”:“d2m0”,“targeting_type”:“BROAD_KEYWORD”,“targeting_value”:“:chestnut:}}]” “/1/batch/accounts/gq0jl7/targeting_criteria”
===> [2016-06-10 20:42:33 +0000 :: ovapjqkws :: 6zy9 :: 400 Bad Request :: 0.645s :: 297/300 (…-74s)] {“request”:[{“params”:{“line_item_id”:“d2m0”,“targeting_type”:“BROAD_KEYWORD”,“targeting_value”:"\uD83C\uDF30",“account_id”:“gq0jl7”},“operation_type”:“Create”}],“operation_errors”:[[{“code”:“INVALID_PARAMETER”,“message”:"Expected valid targeting_value, got “\uD83C\uDF30” for targeting_value",“parameter”:“targeting_value”}]]}

I am hitting POST /1/batch/accounts/gq0jl7/targeting_criteria. Any idea what happened?


#2

It looked like the emoji was not being properly encoded as UTF. Could you try this modified version of your request? It should succeed. If not, could you send the full request and response with headers (via the twurl -t option)?

twurl -H ads-api-sandbox.twitter.com -X POST -A "Content-Type: application/json;charset=UTF-8" "/1/batch/accounts/gq0jl7/targeting_criteria" -d '[{"operation_type": "Create", "params": {"line_item_id": "d2m0", "targeting_type": "BROAD_KEYWORD", "targeting_value": "🌰"}}]' -t


#3

It seems that this is a sandbox issue. The request works in production api.


#4

Sorry that I have to re-open this. Seems like there is a problem explicitly with the negative unorder keywords that expect a Long instead of a string for targeting value?

<=== [2016-06-24 16:39:09 +0000 :: osy6n9bg4 :: 2ju :: 1851862034] twurl -H ads-api.twitter.com -X POST -d "[{"operation_type":"Create","params":{"line_item_id":"5jbxg","targeting_type":"NEGATIVE_UNORDERED_KEYWORD","targeting_value":"🍁🍁🍁"}}]" "/1/batch/accounts/18ce53uuf0f/targeting_criteria"
===> [2016-06-24 16:39:10 +0000 :: osy6n9bg4 :: 2ju :: 400 Bad Request :: 0.322s :: 299/300 (…59s)] {"request":[{"params":{"line_item_id":"5jbxg","account_id":"18ce53uuf0f"},"operation_type":"Create"}],"operation_errors":[[{"code":"INVALID_PARAMETER","message":"Expected valid targeting type, got \"NEGATIVE_UNORDERED_KEYWORD\" for targeting_type","parameter":"targeting_type"},{"code":"INVALID_PARAMETER","message":"Expected Long, got \"\uD83C\uDF41\uD83C\uDF41\uD83C\uDF41\" for targeting_value","parameter":"targeting_value"}]]}

Other positive type keywords worked fine for me. Could you advise?