Facebook Marketing API Adset Filtering - facebook

I am using the Facebook Marketing API and making a call to get the adsets belonging to an adaccount (https://developers.facebook.com/docs/marketing-api/reference/ad-account/adsets/). My issue is that for one of my ad accounts, there are to many adsets available and as such the call is either taking long or has to many pages. Is there a way that i can possiblly add on date filtering to the request so that it will filter out all those adsets outside of the specified dates?
This is the request i am making with a dummy act id:
act_12345678?fields=account_id,name,currency,business{id},adsets{id,name,campaign{id,name,start_time,stop_time,spend_cap,status,insights.date_preset(lifetime){spend}},start_time,end_time,adset_schedule,billing_event,lifetime_budget,budget_remaining,daily_budget,lifetime_imps,status,configured_status,optimization_goal,is_autobid,insights.date_preset(lifetime).as(lifetime_insights){spend}, insights.time_range({'since':'1990-01-01', 'until':'2018-04-26'}).as(insights_to_date){spend}}

It appears that the "filtering" parameter works in this case.
For example, if you want to return all adsets that had a start time greater than 12/31/2017 and less than 01/31/2018, you can try the following.
Note that I had to first convert the start and end dates to a UNIX timestamp:
act_12345678/adsets?filtering=[{'field':'adset.start_time','operator':'GREATER_THAN','value':'1514678400'}, {'field':'adset.start_time','operator':'LESS_THAN','value':'1517356800'}]
You can add the "filtering" parameter to your request URL, and it should then filter both on the dates and the fields you specified.
To convert the dates to UNIX time stamp I used the following link: https://www.unixtimestamp.com/index.php

Related

Recording Followers as of last social media post date within a month [Tableau Calculated Field]

my problem is as follows.
I have social media data for multiple networks (facebook, twitter, instagram, etc.) and multiple profiles within each network. I have a date parameter which controls the dashboard based on year/month of the data history to summarize data by month.
I need to record the followers of each network and profile, in aggregate and separately, for each month. This calculation is tricky because I need to aggregate the followers by the latest post of each profile within the month. I would like to view those audience numbers for the month using a filter by network and profile.
I have tried a number of things to isolate followers for one profile and one network, hoping I could expand this to a scenario with multiple, and not been successful. This has included the following calculated fields:
(Given a filter for one network and one profile already applied)
attempt 1:
IF LAST() = 0 then SUM([Instagram Profile Followers]) END // This one pulls in total followers for last month (641.6K)
attempt 2:
LOOKUP(SUM( if MONTH([Date]) = MONTH([Date Parameter]) and YEAR([Date]) = YEAR([Date Parameter]) then [Instagram Profile Followers] END), LAST()) /// Returns total followers in month
attempt 3:
{ INCLUDE DATETRUNC('month', [Date Parameter]): max([Date Parameter])} /// Returns followers first day in month (b/c using max date parameter (which is technically yyyy/mm/01)
I'm not totally convinced a solution exists when I would like to create an aggregate by all networks and profiles together, given the latest post for each would be different days. If I could at least get the latest followers for one individual network and profile filtered, that would be fantastic. Any help greatly appreciated.

Fetch all Calendars From Office 365 Calendar Account

We need to fetch all Calendars in an office 365 calendar account
We basically make an api call to the endpoint
https://graph.microsoft.com/v1.0/users/[logged-in-user-id]/calendars
but it returns only 10 calendars (maximum) when we call the API !?
Any help/tips appreciated !
You can use $top query parameter to get 1 to 999 objects per page. By default every API has its own default pagination count. So you can simply use top query parameter or you can use nextLink which you get in the first API call and use it to get next set of results. See this document. Let me know if this helps.

Getting all Tweets from a User, after a certain date

You can get all tweets for a user: via the getUserTimeline() method.
You can also get all tweets after a specific date: sinceId() method.
But I want to combine these two. I want to get all tweets from a certain user, but only those tweets which were posted after a given date. Any ideas on how to do this?
I don't understand why you need sinceId(). getUserTimeline() returns a paginated list of Statuses. For each status in the list, doing status.getCreatedAt() returns a Date which is a Comparable. You can easily compare Date instances with each other and determine if a Date occured after another Date.
I wound up just using the id of the tweet, as a marker for the date. I didnt care about the date per se, but simply whether the tweet was before or after the previously loaded tweet. The docs suggest that the id is a more or less reliable indicator of recency. I.e., id 1234 is most likely to be a tweet that was posted before id 1233.
Thanks!

Get home feed of a particular user of a specific time stamp using graph API

I am trying to build a Facebook application by using Facebook Graph API. I am trying to get the home feed of the application user for a particular time span. e.g. From 11-02-2014 to 15-07-2014. I have used since and until in Facebook Graph Explorer but it returned news feed of two consecutive days.
2011-01-01 is the wrong synthax to represent a time on Facebook. You should use Unix timestamps: 1418971177.
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.
Source: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#
So, instead of:
/me/home?since=2011-01-01&until=2011-05-05
You must use:
/me/home?limit=25&until=1418971177 with until.
Or:
/me/home?limit=25&since=1418971128 with since.
Note that you can't use since and until together. You have to use the limit field to restrict the amount of results you get.

get number of updates since a timestamps in facebook

Can we get the number of updates since a particular timestamps using graph APIS? Number of updates might be number of new New feed or Messages.
depending on which api you are calling
When searching for public posts or posts on the user's News Feed, you
can page over the results by using the since, until and limit
parameters. since and until both accept a unix timestamp. When paging
back in time, you should use until in conjunction with limit where
until is the unixtime value of the created_time field in the last
object returned by your previous query. When paging forward in time
you should set since to be the unixtime value of the created_time
field in the first object returned by your previous query. Please
note, you can only search about 1 to 2 weeks back in the News Feed.
/me/feed?since=2+hours+ago&until=now "using strtotime in php"