POST /1/batch/accounts/:account_id/targeting_criteria returning "Missing Parameter" error even though it is provded



I am trying to create targeting criteria through the POST /1/batch/accounts/:account_id/targeting_criteria endpoint and getting “missing parameter” error even though they are provided. Any idea why this could happen?

Below is an example of the request:

<=== [2016-05-11 21:46:12 +0000 :: owkckwri0 :: 5leq :: 1851862034] twurl -H -X POST -d “[{“operation_type”:“Create”,“params”:{“line_item_id”:“55axy”,“targeting_type”:“GENDER”,“targeting_value”:“1”}}]” “/1/accounts/18ce53uuf0f/targeting_criteria”

===> [2016-05-11 21:46:12 +0000 :: owkckwri0 :: 5leq :: 400 Bad Request :: 0.543s :: 299/300 (…47s)] {“errors”:[{“code”:“MISSING_PARAMETER”,“message”:"“line_item_id” is a required parameter",“parameter”:“line_item_id”},{“code”:“MISSING_PARAMETER”,“message”:"“targeting_type” is a required parameter",“parameter”:“targeting_type”},{“code”:“MISSING_PARAMETER”,“message”:"“targeting_type” is a required parameter",“parameter”:“targeting_type”},{“code”:“MISSING_PARAMETER”,“message”:"“targeting_value” is a required parameter",“parameter”:“targeting_value”}],“request”:{“params”:{“account_id”:“18ce53uuf0f”}}}



A few notes:

  1. Be sure you’re passing your request to the batch endpoint. Your sample is to the standard endpoint. Change your path to /1/batch/accounts/:account_id/targeting_criteria

  2. For batch, be sure to pass Content-Type header with the value application/json.

  3. When using twurl and passing a JSON object, use the -r or --raw option rather than -d/--data.