Check if multiple user ids are friends with a particular person - facebook-graph-api

I want to know which people in a list of people are friends with this user. Is there a graph api call that can return the subset of ids that is the user's friends? I've tried:
/me/friends/?ids=xxxxx,xxxx
I know I can use a batch call an do something like this:
/me/friends/xxxx
/me/friends/xxxxx
but it would be nice to do it in one call.

There wasn't an easy way to do this with the graph api, but I was able to do it with an FQL query:
query = '{
"are_friends":"SELECT+uid2+FROM+friend+WHERE+uid1=me()+and+uid2+in('+people_array.join()+')+limit+10",
"friend_meta":"SELECT+uid,first_name,last_name,name,pic_square+FROM+user+where+uid+in(SELECT+uid2+FROM+%23are_friends)"}'
The friend_meta json object in the result will have all the meta info you are looking for. It's one call, and more efficient and cleaner than the batch calls.

Did you try the mutualfriends option?
me/mutualfriends/xxxxx
https://developers.facebook.com/docs/reference/api/user/

Related

Can I get the data of those whom I am not following on twitter?

I seem to be having problems with this in the twitter API.
I want the global data from the API which includes :
1. All those posts from the users I am following.
2. All those posts from the users I am not following.
Is this possible with the twitter API ? Has anyone tried it before ?
I'm using python, but any type of answer would be helpful.
Yes it is possible.
What you can do is say create a list of customers(those whom you follow) in a database...now check for each tweet if it from your customer then pass if not then do as desired.
if you can get data of those whom you are following then you can also get data of those whom you are not following

FaceBook Graph API: Search beyond immediate circle

Is it possible to search for users which are beyond my immediate circle using FB graph API?
If not, does having a paid subscription account help to overcome this hurdle?
I'm using following graph query but seems to be restricted within my circle:
https://graph.facebook.com/search?q=xx+yy&limit=5000&type=user&access_token=*
Also if I increase the offset using pagination in the next call, It will still returns the same set of user IDs. So not sure if I'm passing the parameters incorrectly or missing some other parameters.
Thanks for all your help in advance!
Not sure what you mean by your immediate circle in terms of Facebook but I assume you mean your friends. The Graph API allows you to search for all public objects (source) - this means every person (according to answers on this page since names are always publicly available - that's my understanding), not only people who you are friends with on Facebook.
Hence, when you're searching for "John" you should get everyone called John if you're using the Graph API correctly - make sure your access token is valid (you do not need any special permissions to search for people) and your syntax follows the example from here.
In order to test your query I suggest you use the Graph API Explorer before adding the query to your application code. It's a quick way to see if the error is in your query or elsewhere. For example, if you want to find everyone named John, use this link http://developers.facebook.com/tools/explorer?method=GET&path=search%3Fq%3DJohn%26type%3Duser. Just make sure to click Get access token on the right if you're using the Explorer for the first time, otherwise the query will return an error.

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=

How do I retrieve Haystack SearchQuery parameters

I am looking for a way to serialize a Haystack search query (not the query results) so that I can reconstruct it later. Is there a way to do this without having to intercept the parameters from off of the request object?
For context, I want users to be able to subscribe to the results of a particular search, including any new results that may pop up over time.
Edit:
I settled on storing the search with:
filter = queryset.query.query_filter
and then loading this back in using:
SearchQuerySet().raw_search(filter)
Though I suspect this will tie me to whichever particular search back-end I'm using now. Is this true? Is there a better way?
You should have the query in your request.GET. Then it should be fairly easy to construct a RSS Feed using that query.

Can you build a truly RESTful service that takes many parameters?

After reading an article on REST ("Restful Grails"), I have gotten the impression that it is not possible to truly conform to a REST style in a service that demands a lot of parameters. Is this so? All the examples I have seen so far seem to imply that true REST style services are "parameterless". Using parameters would be RPC-ish and not truly RESTful.
To be more specific, say we have a service that returns graph data for stock prices, and this service needs to know the start date, end date, the currency, stock name, and whatever else might be applicable. In any case, at least 4-5 parameters are needed to retrieve the information needed.
I would imagine the URL to be something like this : /stocks/YAHOO?startDate="2008-09-01"&endDate=...
("YAHOO" is here a made-up stock name).
Would this really be REST or is this more RPC-like, what the author of the aforementioned article calls "GETful" (i.e. just low ceremony rpc)?
You can see the querystring as a filter on the resource you are GETing. Here, your resource is the stock prices of yahoo. Doing a GET on that resource give you all the available data, or the most recents. The query string filter the prices you want. Content negociation allow you to change the representation, e.g. a png graph, a csv file, and so on. To add a price, simply POST a representation (e.g. CSV) to the same resource.
The "restfulness" is not realy in the URL itself, since URIs are obscures to client, but in the way you interact with resources themselves identified by their URI
Feel free to use as many parameters as you need to identify the resource you wish to access. REST doesn't care.
Why would you think it is not possible?
Google uses REST for their charts api, and they take alot of params:
http://chart.apis.google.com/chart?cht=bvg&chs=350x300&chd=t:20,35,10&chxr=1,0,40&chds=0,40&chco=FF0000|FFA000|00FF00&chbh=65,0,35&chxt=x,y,x&chxl=0:|High|Medium|Low|2:||Task+Priority||&chxs=2,000000,12&chtt=Tasks+on+my+To+Do+list&chts=000000,20&chg=0,25,5,5