Graph API, Get ads filter with created date or Date range

1.2k views Asked by At

Is there any way to get ads in specific time range using graph API. I need to get ads from the last week.

Right now I'm doing this:

/act_{ad_account_id}/ads?limit=25&time_rang[since]=$date_from&time_range[until]=$date_now

But this is not working, it's returning ads even from outside the specified time range.

3

There are 3 answers

0
Jeff S. On

You can filter on updated_since, and request the created date in the result, which your code can then use to include or exclude.

act_{account ID}/ads?fields=created_time&updated_since=1485925200

0
espy On

For those using the Facebook Node.js Business sdk, Facebook is expecting seconds and not milliseconds (which is what you might expect while working with JavaScript) for the updated_since.

1
Good Friday On

If anyone wonders what value of updated_since is, it is timestamp.