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

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.

Related

How do you get the user ids of the users who have read access to a specific record using the Salesforce REST API?

I am trying to retrieve a list of user ids that have read access to a specific record from the Salesforce REST API.
I have been able to use the UserRecordAccess SObject and the following SOQL query to check if a single user has access to the record.
SELECT RecordId, HasReadAccess FROM UserRecordAccess WHERE RecordId = '{insert record id}' AND UserId = '{insert user id}' AND HasReadAccess = true
However, a limitation of this query is that UserRecordAccess does not let you "SELECT" the UserId.
e.g
SELECT RecordId, UserId FROM UserRecordAccess
Is there another way to get this information?
I want to avoid sending a request for every single user per record.
Any help would be greatly appreciated.

FQL get feeds from multiple users

I need to retrieve the wall posts of multiple Facebook Users . So far, I manage to retrieve the data from just one User but I need to get it from 60 users aprox. Here is my FQL query in objective C, I understand the query sintax is the same in every language:
[fql.parameters setObject:#"SELECT message,attachment FROM stream WHERE source_id in
(SELECT id from profile where username = 'zara' )" forKey:#"q"];
Please I need help! Thanks in advance.
You can do this by looking for updates in an array of usernames:
SELECT message,attachment FROM stream WHERE source_id in
(SELECT id from profile where username IN ('zara','zuck','theuncrunched','thepaulcarr'))

Facebook FQL. Table 'columns' contain wrong fields

Why the next Facebook FQL:
select column_name from columns where table_name = 'user' order by column_name
return are different list of columns then in api page http://developers.facebook.com/docs/reference/fql/user
for example it return field 'can_viewer_send_poke_message' but facebook tell that
(#602) can_viewer_send_poke_message is not a member of the user table
So, I just trying to automate process to keep some hql queries with full list of Columns of each hql table.
May be is there some other way to get for each table column list as string separated with ","?
This is a private field for Facebook Developers of the Official Poke Application for iPhone. It checks whether the users listed (friends) can use the poke application.

Facebook IN clause in FQL query

I have a big problem with Facebook FQL, if i do
select message from stream where source_id=175102475936031
I can get the correct data, if i do this
select message from stream where source_id IN(175102475936031,etc,etc,etc)
I got a empty JSON, why? is there any alternative to this select? I have to read the messages from multiple events.
Is your problem solved?
"IN" query is a supported feature of FQL. I have tried it multiple times.
Only needs to have:
column indexable
needs to have permission to access data
data should be present for at least one column :P
select message from stream where source_id IN( 175102475936031, etc, etc, etc)
"NOT IN" is not a supported feature of FQL. Ref: http://forum.developers.facebook.net/viewtopic.php?id=1420

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.