12

When I get data from Facebook graph explore with query string

act_109418612584009/campaigns?fields=id,name,adsets{id,name,insights}&since=2016-03-07&until=2016-03-08

Result I get is full data (not range in since and until).

2016-03-17: Update

Wrong way, i had read document and solve it.

Find this at https://developers.facebook.com/docs/marketing-api/insights/v2.5

Struct of query is

https://graph.facebook.com/<API_VERSION>/<AD_OBJECT_ID>/insights

So meaning i can get data with query

https://graph.facebook.com/v2.5/6032185014626/insights?time_range={"since":"2015-03-01","until":"2015-03-31"}

6032185014626 is Id of adset

Happy coding

killua zoldyck
  • 121
  • 1
  • 1
  • 8

1 Answers1

4

Have a look at

A time-paginated edge supports the following parameters:

  • until : A Unix timestamp or strtotime data value that points to the end of the range of time-based data.
  • since : A Unix timestamp or strtotime data value that points to the start of the range of time-based data.
  • limit : This is the number of individual objects that are returned in each page. A limit of 0 will return no results. Some edges have an upper maximum on the limit value, for performance reasons. We will return the correct pagination links if that happens.
  • next : The Graph API endpoint that will return the next page of data.
  • previous : The Graph API endpoint that will return the previous page of data.

You need to send unix timestamps instead of dates (YYYY-MM-DD).

Community
  • 1
  • 1
Tobi
  • 31,405
  • 8
  • 58
  • 90
  • 1
    You read over the second part here, _“A Unix timestamp **or strtotime data value**”_ – therefor `2016-03-07` should be fine, `strtotime` has no trouble parsing that. – CBroe Mar 14 '16 at 10:37
  • @CBroe I'm not a PHP user at all, so I unfortunately overlooked this. Unix timestamps always worked for me though. If this is reproducible, the OP should create a bug at https://developers.facebook.com/bugs/ – Tobi Mar 14 '16 at 11:12