I am on developer access and am setting up a paused test campaign. I wish to post targeting criteria to a line item, specifically INTERESTs with multiple targeting values. I believe the standard way of posting several targeting values is a string list of targeting values, joined by commas. The targeting values I am using are:

‘1004,12001,12002,12003,12004,12005,12006,12007,12008,12009,12010,12011,12012,12013,12014,12015,12016,12017,12018,12019,12020,12021,12022,12023’

I’ve attempted to make this request using two URLs, one with commas encoded and one without as follows:

Encoded:
https://ads-api.twitter.com/0/accounts/xxxxxx/targeting_criteria?targeting_type=INTEREST&line_item_id=xxxxx&targeting_value=1004%2C12001%2C12002%2C12003%2C12004%2C12005%2C12006%2C12007%2C12008%2C12009%2C12010%2C12011%2C12012%2C12013%2C12014%2C12015%2C12016%2C12017%2C12018%2C12019%2C12020%2C12021%2C12022%2C12023

Not encoded:
https://ads-api.twitter.com/0/accounts/xxxxxx/targeting_criteria?targeting_type=INTEREST&line_item_id=xxxxx&targeting_value=1004,12001,12002,12003,12004,12005,12006,12007,12008,12009,12010,12011,12012,12013,12014,12015,12016,12017,12018,12019,12020,12021,12022,12023

The error appearing is:
{“errors”:[{“code”:“INVALID_PARAMETER”,“message”:“Expected Long, got \“1004,12001,12002,12003,12004,12005,12006,12007,12008,12009,12010,12011,12012,12013,12014,12015,12016,12017,12018,12019,12020,12021,12022,12023\” for targeting_value”,“parameter”:“targeting_value”}

I may be formatting the URL incorrectly, anyone know how to post multiple interests to a line item together? I’ll also wish to do a similar POST request for location targeting.

Thanks,
Eamonn

Hi Eamonn,

For setting multiple values you should be using the PUT variant instead of POST. Please let us know if this solves your problem or not.

Thanks,

John

Hi John,

Just figured it out myself. I have to PUT the IDs as interests and obtain a targeting_value, one for each targeting_type. Then I can make a POST using targeting_value as a long.

Thanks for your help,
Eamonn