Getting list of names from id array for facebook? - facebook

I am looking to grab the names of facebook users from an array of about 100 ids and store in php variables. Is there a way to do it without making api calls or using curl for each id in a loop?

Yes:
https://graph.facebook.com/?ids=id1,id2,...,idX&fields=name

You can do this:
You can run an FQL query on the 'user' table to get their name.
Here are a few links for more information:
http://developers.facebook.com/docs/reference/fql/
http://developers.facebook.com/docs/reference/fql/user/

Related

Moodle: Is it possible to get all blog entries by a teacher/admin in the form of an array etc.?

Just like we have get_courses function to get an array of all the courses, is there a way to retrieve a list (array, object, anything) of all the blog posts made by a user, or may be all of the blog posts on the site?
By some function? or by a database call?
The blog posts are in this table
SELECT *
FROM {post}
WHERE module = 'blog'
There's a few fields in there for user, course etc.

Use Facebook API to list group members' join date and inviter

I can use the Facebook Graph API to get a list of group members. The simplest way to do this is to go to the Graph API Explorer and do a GET request of the form {group_id}/members. Is there a way to similarly obtain the members' join date and who they were invited by?
The relevant Graph API doc doesn't seem to mention it. But I know the information is stored by Facebook because it is possible to list all of the group members and their inviters through Facebook itself. Is there a way to get this information through the API?
EDIT: Nothing in the FQL group or group_member API either.
While this information is not available on the API, you can get it by using Selenium to scrape the members page.
First, instantiate a driver and use it to get the members page:
driver.gethttps://www.facebook.com/groups/your group number/members
Then, look for the member information:
containers = driver.find_elements_by_tag_name('td')
Finally, iterate through the web elements, extracting text and parsing resulting list for joined date information:
member_info = container.text.split('\n')
name = member_info[0]
member_since = member_info[-1]
You'll still have to map this information to the user ids, which you can do by looking for another element in the container and using REGEX.
`def parse_id(self, container, name):
hovercard = container.find_element_by_link_text(name).get_attribute('data-hovercard')
regex_id = re.compile('php\?id=(\d*)')
member_id = regex_id.search(hovercard).group(1)
return member_id`
It is indeed stored by Facebook and retrieved for use with internal APIs. For the Graph API however it is not possible to get this information.
All the fields available for a group_member are listed at SELECT column_name FROM column WHERE table_name = "group_member"

Joining two tables and fetching records in a single query in FQL

Hi i have written a query by which i can fetch posts,actor_id,comments and other columns required from stream table. But i want to fetch user's name also along with actor id and other columns in a single query.
My queries is :
select message,created_time,actor_id,attachment,comments,created_time,impressions,likes,message,message_tags,place,share_count from stream where source_id in (any_page_id)
I want to add user's name also from user table along with this list of columns i am fetching from stream table in a single query so that i can handle it in a single json file. .
Also in comments we will get several user's id with comments as from_id. Can we get username for this from_id also. Is this possible, i know we cannot use join in FQL. Or i am missing something or in a wrong approach. Please help me out. Thanks in advance.
Updated
Now i am able to get actor_id and other fields of the post together along with user's name at the end in the same json using multi-query. Something similar to :
fql?q={"query1":"select+message,created_time,actor_id,attachment,comments,created_time,impressions,likes,message,message_tags,place,share_count+from+stream+where+source_id+in(any_page_id)","query2":"select uid,name from user where uid in (*#query1* "}
But now i am not able to get the user's name and user's id who are there in the comments of the post in the same json.

Is the 'is_minor' column in the Facebook FQL user table always NULL?

The Facebook FQL user table has a column called is_minor.
The Facebook platform documentation does not indicate that any special Permission is required to access the data in this column. However, all of my attempts to get any data from this column always return NULL. And I've tried everything I can think of...
(I have no problem accessing all sorts of other data from other columns in the FQL user table.)
Does anyone know... is the is_minor column simply not populated at all? Has anyone had any success accessing data from this column?
Well, it turn out this is actually a bug. Facebook has confirmed and assigned it.
http://developers.facebook.com/bugs/217123218363794
(Phew. I'm not crazy.)

Use Facebook FQL to select the work information from the profile

I would like to get work place information of a user using FQL.
When I use the Graph API and get the User object, it contains work information, which is essentially a list of the work history. The list elements contain nodes of employer, location, description, etc...
The nodes appear to be pages internally. If I take the id of a node, e.g. from the employer, and use FQL to query a page with that page_id, I do get an object with corresponding information.
My question now is, how do I use FQL to get the same information without accessing the Graph API? What table stores the work-related information, for example how do I find all the page_id of the employers of a given user?
The reason I insist on using FQL only is performance. Of course I could access the Graph API for all the users in question and get the info that way, but I'm looking for an FQL-only solution.
You can get this information from FQL. Read the "user" table and look for the work field. The JSON data returned should be the same format as the one for Graph, i.e., the result is an array and each result should include an "employer" object with an "id" and "name" field.
You will need user_work_history or friends_work_history to access this field.