how to get todays feeds using graph api - facebook-graph-api

I am using graph api explorer to test my results.
I tried getting todays posts by the below query
1061547241/feed?fields=object_id&since=1378122100&limit=100
I am confused with the since parameter. some one help get todays posts using since parameter.

Lets take a look at the documentation for graph api:
https://developers.facebook.com/docs/reference/api/pagination/#timepaging
According to that it uses http://php.net/manual/en/function.strtotime.php function to convert the "since" parameter. So if you want to get it for today you can do something like:
1061547241/feed?fields=object_id&since=today
This would give you feed since start of the day i.e. 00:00:00.
For more details on formats you search for datetime.formats in php, doesn't allow me to post more than 2 links.

Related

Amazon ItemSearch API reponse different from amazon.com search results

I am trying to figure out the right parameters for ItemSearch such that the API call will return the same result as on the website. Currently I am using these params it is not consistent with the website.
url_params = dict(
Service='AWSECommerceService',
Operation='ItemSearch',
AssociateTag=AMAZON_ASSOCIATETAG,
SearchIndex='All',
AWSAccessKeyId=AWS_ACCESS_KEY_ID,
Keywords=keywords,
ResponseGroup='Small,OfferSummary,Images'
)
For example if 'iphone%205s' is put in keywords, the API returns a list of iPhone protectors, while searching on the website gives iPhones as top results.
I am also trying to figure out why this is for book searches. One possible answer I found online was that the websites search feature might use more elaborate queries than just one simple API call. For example, it may take into account other factors into the search (not sure what that might be but it may).

Forward search RestFB

I am using RestFB to search multiple terms on Facebook. I am using following code to achieve that.
Connection<Post> publicSearch = publicOnlyFacebookClient
.fetchConnection(
"search",
Post.class,
Parameter.with("since",
DateFormatter.stringToDate("2013-01-01")),
Parameter.with("q", "apple OR oranges"),
Parameter.with("type", "post"));
I have two questions.
Is this the correct way of using OR
I observed, even when I have mentioned "since" I get results in decreasing order in timestamp. The results start from NOW and go backwords. Is there a method to start getting methods in forward manner (something like twitter streaming API)?
You can use the | character for OR (e.g apple | oranges)
Graph API always returns the latest results first, there are no parameters to control that. To work around this you could implement a Comparator that compares the Post class by time and sort the result List using Collections.html#sort(java.util.List, java.util.Comparator)

Getting the facebook graph to only return results with a # symbol in it

Any one have any ideas on how to accomplish this?
I have tried
https://graph.facebook.com/search?q=%22%23apple%22
https://graph.facebook.com/search?q=%23apple
https://graph.facebook.com/search?q#apple
which does not work.
To be clear the results should only have posts that contain #apple not "apple".
Facebook says this is not supported at this time: https://developers.facebook.com/x/bugs/313941462054417/
if you're trying to get the #hashtags from Facebook, currently, there is no api for this. and even if there were- the posts are not intermediate, they are being cached. you won't see the most recent hashtag from a person who's not in your friendlist right away, this will take a long time to appear in the hashtag search
I've read too that it's not supported but,
trying the second line of jlarry
https://graph.facebook.com/search?q=%23apple
in Graph API Explorer, it works.
obviously the query is on the posts set as public.
so the query could be something like this
https://graph.facebook.com/search?q=%23joviberton‬&type=post
for further ops check https://developers.facebook.com/docs/graph-api/using-graph-api/

Facebook Graph API Filters - What options are available?

It seems that you can make a call to the Graph API that looks like this:
https://graph.facebook.com/me/checkins?since=yesterday
Apparently you can pass either a UNIX timestamp or any valid strtotime value.
The questions...how do you know what other options are available to you in the request? I don't see any documentation about this "since" filter or any other similar filter. Is this information just trickling down from people who know some API engineers at Facebook?
I know that there are some things that you can do in FQL that are similar to what I was describing but I want to stay with the Graph API if I can.
Thanks
--Tony
Anothony Lee:
since, until - (a unix timestamp or any date accepted by strtotime):
EG: since=yesterday until=now, since=6+months+ago until=3+months+ago,
since=10/01/2011 until=10/11/2011
another example
&since=noon+monday+last+week &until=10+minutes+ago.
you need to provide the date filter as shown in the below link. time_range should be attached to the insights.
try this
https://graph.facebook.com/v6.0/me?fields=id%2Cname%2Cadaccounts%7Bcampaigns%7Badsets%7Bads%7Binsights.time_range(%7B'since'%3A'2020-05-01'%2C'until'%3A'2020-05-01'%7D)%7Badset_id%2Ccampaign_id%2Cad_id%2Cclicks%7D%7D%7D%7D%7D&access_token=

fql for place name and place id useing com.restfb

I have coordinates as latitude and longitude, I want to get a list of place from facebook using facebook query (FQL). Does anyone have an example of how to to that? I am also fine with using the graph api
It's easy with the Graph API:
https://graph.facebook.com/search?q=coffee&type=place&center=37.76,-122.427&distance=10000&access_token=AAAAAAITEghMBAB7yPm6SoZAeJyU7MnYXqllWwcTLQDZB2g96QCmpb2B2QDAWtPfCkRJtCN8tnPbDrTqaZA6M9fmHdm1FXB0kbmaXEShDwZDZD
(Via the online documentation)
I can't get it to work with FQL, although the correct syntax appears to be:
SELECT name,description,geometry,latitude,longitude,checkin_count,display_subtext FROM place WHERE latitude=40.797702 AND longitude=-105.587082
(Try it)