Andrien Pecson
Andrien Pecson

Reputation: 282

Facebook Ads API time_range Issue

I'm trying to use the Facebook Graph API to get the list of ads for specific dates. The issue is that the time_range value I am passing is being accepted by the Facebook API endpoint but the result is incorrect.

Here is a sample endpoint I am using:

https://graph.facebook.com/v13.0/act_xxxxxxxx/ads?fields=id,ad_review_feedback,updated_time,preview_shareable_link&limit=5&access_token=xxxxxxxx&time_range={since:'2022-03-01',until:'2022-03-02'}

The result list shows a list of ads beyond the indicated time ranges.

Upvotes: 0

Views: 401

Answers (1)

halillusion
halillusion

Reputation: 338

Your problem has probably been solved. However, I would like to share details on how I solved the problem for those who still experience the same error and reach this page while searching.

This problem is directly related to the limit parameter. If you experience a data incompatibility, try defining the limit parameter if it is not defined, or increasing its value if it is defined.

For example, the final api url in my case is as follows;

https://graph.facebook.com/v20.0/act_xxx?fields=campaigns.filtering([{field:"spend",operator:"GREATER_THAN",value:0}]).limit(1000){id,name,effective_status,created_time,start_time,stop_time,objective,insights.breakdowns(age).time_range({'since':'2024-12-10','until':'2024-12-17'}).time_increment(1).limit(1000){spend,impressions,clicks,actions,action_values}}&access_token=xxx

Upvotes: 1

Related Questions