Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook graph SINCE and UNTIL not working

Tags:

facebook

api

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

like image 885
killua zoldyck Avatar asked Mar 14 '16 07:03

killua zoldyck


1 Answers

Have a look at

  • https://developers.facebook.com/docs/graph-api/using-graph-api#reading (chapter Time-based Pagination)

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).

like image 79
Tobi Avatar answered Sep 20 '22 22:09

Tobi