When specifying targeting criteria for a new campaign, we are seeing issues with specifying locations as targeting criteria. We are retrieving locations from the targeting_criteria/locations endpoint. Any help in troubleshooting this issue?

For example, it is throwing the following error: “Expected valid targeting_value, got "34160e1f6e180cca" for targeting_value”

Could you provide more information?

Give us the raw request for this request and also for the request where you get that targeting value.

Regards

Here is the request that fetches the targeting value and also the request that its trying to create the targeting criteria for the campaign with that value. Could that inconsistency could be related with the fact that sandbox mode doesn’t have targeting criteria data up to date?

REQUEST that gets the targeting value from twitter

URL: https://ads-api.twitter.com/0/targeting_criteria/locations
Body:
{ q: ‘IL’, count: 1000 }

Response:
[

{
“name”:“Ilkadim, Samsun, Turkey”,
“targeting_type”:“LOCATION”,
“targeting_value”:“1a8b70e8164a6d74”,
“location_type”:“REGION”
}

]

REQUEST that tries to save the targeting criteria

URL: https://ads-api-sandbox.twitter.com/0/accounts/gq10ri/targeting_criteria

Body:
{
“params”: {
“line_item_id”:“d4ft”,
“targeting_type”:“LOCATION”,
“targeting_value”:“1a8b70e8164a6d74”,
“account_id”:“gq10ri”
}
}

Response:
ERROR [INVALID_RESPONSE_CODE] {“status_code”:400,“body”:{“errors”:[{“code”:“INVALID_PARAMETER”,“message”:“Expected valid targeting_value, got "1a8b70e8164a6d74" for targeting_value”,“parameter”:“targeting_value”}],“request”:{“params”:{“line_item_id”:“d4ft”,“targeting_type”:“LOCATION”,“targeting_value”:“1a8b70e8164a6d74”,“account_id”:“gq10ri”}}}}

That’s the mistake!, Ads Api Sandbox doesn’t has all the locations

1 Like

hello twitter,
my request model as below:
URL: /ads-api-sandbox.twitter.com/8/accounts/gq7mkg/targeting_criteria
POST

parms:
line_item_id:g5cg
targeting_type:BROAD_KEYWORD
targeting_value:technology
operator_type:EQ

still getting below error even while targeting only keywords:

{

"errors": [

    {

        "code": "SERVICE_UNAVAILABLE",

        "message": "Service unavailable due to request timeout; please try the request again later"

    }

],

"request": {

    "params": {}

}

}

1 Like

@TwitterDev any update or information regarding above problem. ?