Getting TwitterAds data from all campaign

ads
api
twitterads

#1

Hi all,

I actually get the stats of a specific campaign without an issue. However I need to get the id of the campaign before getting the data by doing :
step 1 : twurl -H “ads-api.twitter.com” “/2/accounts/18ce549yq2z/campaigns” | jq
step 2 : twurl -H ads-api.twitter.com “/2/stats/accounts/18ce549yq2z?start_time=2017-11-02&end_time=2017-11-02&entity=CAMPAIGN&entity_ids=751hv&metric_groups=ENGAGEMENT,BILLING,VIDEO&granularity=TOTAL&placement=ALL_ON_TWITTER
” | jq

My questions : Is there a way to get all the stats from (example) yesterday from all our campaigns ? something automatically that prevent me getting the id of each campaign and then type them on the twurl get request

thanks in adavance,


#2

@kr_api: There isn’t a way to request stats for all campaigns.

Our synchronous and asynchronous analytics endpoints take a maximum of 20 entity_ids per request.

If you want to avoid making requests to the GET accounts/:account_id/campaigns endpoint, you should cache the campaigns—or whatever entity you’re interested in retrieving data for—on your end.

Thanks.


#3

thanks for the clarification Juan