Search code examples
facebook-graph-apifacebook-fql

Facebook graph api converted to Fql with "where"


I have this api req. Which groups the questions from the page with the name's of voted users ; user id .... etc

367298846687999?fields=questions.fields(id,created_time,question,options.fields(name,votes.fields(id,username),vote_count,from)) 

But it returns all questions on the page.

I need to get the questions by selecting date of creation. Like Month(created_time) = 4 and year(created_time) = 2012

It seem I need fql but there is nothing about getting the questions from the page by page id.

Can we convert the api code that I put to be fql?


Solution

  • Here is the FQL

    SELECT id,owner,question,created_time FROM question WHERE owner=367298846687999

    To limit the questions to only those asked in April 2012 you need to add AND created_time >= 2012-04-01 AND created_time <= 2012-04-30 to your query.

    To get the options and votes, you'll need to construct a multiquery where you pass the result of the first query to the subsequent queries to get the information from the question_option table, and then those results to get the question_option_votes.