Twurl POST method for async api calls to Twitter Ads Stats Fails


I am trying to use the async endpoint for my twitter ads stat queries, so instead of using

GET /1/stats/accounts/:account_id

I’ll use

POST /1/stats/jobs/accounts/:account_id

So, just to double check, the GET works fine.

twurl -H "" "/1/stats/accounts/{accountId}?entity_ids={entityId}&start_time=2017-06-05T07:00:00+0000&end_time=2017-06-10T07:00:00+0000&entity=ORGANIC_TWEET&granularity=DAY&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER"

But hen, when calling the POST method, the twurl throws at me

"The Twitter REST API v1 is no longer active. Please migrate to API v1.1."
but changing the 1 to 1.1 supressed this error,

so I try:

twurl -X POST "" "/1.1/stats/jobs/accounts/{accountId}?entity_ids={entityId}&start_time=2017-06-05T07:00:00+0000&end_time=2017-06-10T07:00:00+0000&entity=ORGANIC_TWEET&granularity=DAY&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER"

and all that I get returned is html of 404 page

I’m not sure where the problem is, mostly if I’m trying to use the endpoint correctly. Can you please point me to the right direction, where to look for solution?
Have a nice day,
Thank you!



Do you have the -H flag included in your twurl call ahead of the domain, for the post?


ah, ~facepalm, seems like there was a mistake with the twurl flags, just as you said. Now the request works with POST /1/stats/jobs/accounts/{accountId} endpoint and jobs can be queried by the GET method, all smooth.

Sorry for wasting your time with this silly mistake.
Thank you, have a nice day!


Not a problem, @karin_datapine. Happens to all of us. Thanks for reaching out!