HTTP/1.1 400 Bad Request when create JOB_ID without param entity_ids


#1

I create a request POST /1/stats/jobs/accounts/:account_id (https://dev.twitter.com/ads/reference/1/post/stats/jobs/accounts/account_id).
I want to get report data for each account_id (not group by campaign or line_item), so I do not input entity_ids.
I have a question about parameter. In document, I see parameter entity_ids is not required (column Required = false). But if i do not add this param, it return error HTTP/1.1 400 Bad Request (I could get response if I provide this param). What is the problem?


#2

Could you share with us your request in Twurl format?

Thanks!


#3

My request is:
POST https://ads-api.twitter.com/1/stats/jobs/accounts/:account_id?placement=ALL_ON_TWITTER&metric_groups=ENGAGEMENT%2CBILLING%2CMEDIA&start_time=2017-04-20&end_time=2017-04-27&entity=PROMOTED_TWEET&granularity=DAY&segmentation_type=GENDER


#4

It looks like entity_ids is not a required parameter when ENTITY is ACCOUNT.

If you want to make that requests and get the information for your account, this is the request you should do:

twurl -H ads-api.twitter.com -d 'placement=ALL_ON_TWITTER&metric_groups=ENGAGEMENT,BILLING,MEDIA&start_time=2017-04-20&end_time=2017-04-27&entity=ACCOUNT&granularity=DAY&segmentation_type=GENDER' /1/stats/jobs/accounts/ACCOUNT_ID

Thanks


#5

hector_borras: Your answer is correct.
Thank you very much. It helps me so much.