thrive_dev9925
thrive_dev9925

Reputation: 21

time range filter on ads endpoint (Facebook API)

We are trying to filter results of ads using date parameters on the /v2.7/{ad-account-id}/ads endpoint

According to the docs, you can use a time_range parameter, but it doesn't seem to be working properly using the PHP SDK or the graph explorer, example:

act_{1234456}/ads?time_range={'since':'2016-08-01','until':'2016-08-12'}

The documentation is pretty unclear on this because there is 2 references to the same ads endpoint but each with different params

https://developers.facebook.com/docs/marketing-api/reference/adgroup

https://developers.facebook.com/docs/marketing-api/reference/ad-account/ads/

Has anyone found a way to successfully filter by date/time range on the ads endpoint?

Upvotes: 2

Views: 3330

Answers (1)

Ilya
Ilya

Reputation: 352

The right way to use the time_range param is as follows:

&time_range[since]=YYYY-MM-DD&time_range[until]=YYYY-MM-DD

make sure that square brackets are not url-encoded.

Upvotes: 2

Related Questions