How to *read* my wall...

Mar 19, 2010 at 5:22 PM
Edited Mar 19, 2010 at 5:32 PM

I have been searching for several days now and cannot seem to find anyone that has done this.  Usually that means it's something really easy and I'm just missing something, so I hope someone here can help me out!  :-)

I have generated an infinite session key to use in my asp.net website.  The goal is to display MY wall on my personal web page.  I've been able to get my *statuses* with the following code:

 

        Facebook.Rest.Api api = new Facebook.Rest.Api(connectsession);
        api.Session.SessionKey = "a1929109bd07b79cdfe477a4-695917044";
        api.Session.UserId = 695917044;

 

        Facebook.Rest.Api api = new Facebook.Rest.Api(<connectSession>);
        api.Session.SessionKey = <My Session Key>;
        api.Session.UserId = <My User ID>;
IList<Facebook.Schema.user_status> statuses = api.Status.Get();

 And I have tried to get my news feed by using the following code:

         string fqlOutput = api.Fql.Query("SELECT post_id, actor_id, target_id, created_time, message FROM stream WHERE source_id in (SELECT target_id FROM connection WHERE source_id=<My User ID>) AND is_hidden = 0"); //"SELECT actor_id, message FROM stream"); //limit 50");

        XDocument xml = XDocument.Parse(fqlOutput);

        XNamespace fbns = XNamespace.Get("http://api.facebook.com/1.0/");
        var feed = from fql_feed in xml.Root.Elements(fbns + "stream_post")
                      select new
                      {
                          PostID = fql_feed.Element(fbns + "post_id").Value,
                          ActorID = fql_feed.Element(fbns + "actor_id").Value,
                          Time = fql_feed.Element(fbns + "created_time").Value,
                          Message = fql_feed.Element(fbns + "message").Value
                      };

 

This returns a random number of results (usually between 3 and 4) none of which appear on my wall on facebook.  Is there anyone out there that has successfully pulled their wall down or perhaps their news feed that can help me out?

Thanks!

 

Mar 21, 2010 at 10:09 PM

Finally!!  A break through!  sort of... I found this nifty tool http://developers.facebook.com/tools.php?api&app_id=2227470867 where I can test my FQL queries.  Turns out every one that I have been trying works!  So it seems like there is a bug in toolkit!  

Has anyone else run into this issue?  Many of my queries that I run using the Facebook.Rest.Api.Fql.Query() method do not return results, but they work just fine when testing on the facebook developer site.

Anyone???

Mar 24, 2010 at 3:21 AM

I still am not getting anywhere with this.  Am I totally missing something here?  Has ANYONE had luck pulling their wall or the news feed using the Facebook Developer Toolkit???

Mar 24, 2010 at 3:26 AM

I only use FQL.Query for anything I pull from facebook.  What is the exact string that you're putting into the Query?

Mar 24, 2010 at 4:24 AM

I have tried a number of different queries all with mixed results.  I have tried the query that I mentioned in my first post, but have also tried the following with no results returned or 2 or three.

1. SELECT post_id, source_id, message FROM stream where source_id = MY_FACEBOOK_ID_NUMBER Limit 10  //This returns no records - same result when I remove "Limit 10"
2. SELECT name, sex, pic_square FROM user WHERE uid IN ( SELECT uid2 FROM friend WHERE uid1= MY_FACEBOOK_ID_NUMBER)   //This returns a ton of records (all my friends)
3. SELECT post_id, actor_id, target_id, message FROM stream WHERE source_id in (SELECT target_id FROM connection WHERE source_id= MY_FACEBOOK_ID_NUMBER) AND is_hidden = 0  //This returns 6 records which seem to be actual feed entries, but they aren't the ones on my home screen, I can't even find some of them, and the results are never consistent.
4. SELECT post_id, actor_id, target_id, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid= MY_FACEBOOK_ID_NUMBER AND type='newsfeed') AND is_hidden = 0  //This returns no records 

<fql_query_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list="true">
  <stream_post>
    <post_id>1387494760_107367835957665</post_id>
    <actor_id>1387494760</actor_id>
    <target_id xsi:nil="true" />
    <message>The fires have started in the Eastern part of the county. You burn down your own houses, I don't get it. Every year same ol' thing.</message>
  </stream_post>
  <stream_post>
    <post_id>100000004106932_111395912206938</post_id>
    <actor_id>100000004106932</actor_id>
    <target_id xsi:nil="true" />
    <message>We Live, We Love, We Forgive, And Never Give Up.</message>
  </stream_post>
  <stream_post>
    <post_id>737450692_103125876389223</post_id>
    <actor_id>737450692</actor_id>
    <target_id xsi:nil="true" />
    <message>had fun at the Predators game tonight even though they lost :(</message>
  </stream_post>
  <stream_post>
    <post_id>674559564_112636502079948</post_id>
    <actor_id>674559564</actor_id>
    <target_id xsi:nil="true" />
    <message>Who is this call for? Anyone that
-Wants to lose weight ( a 
little or a lot). Summertime is coming!
-Would enjoy more energy
-Would
like to perform better at work or play
-Is on AdvoCare products but 
wants to speed up results
-Would like to enhance their workouts
-Would
like a launching point for optimal wellness
-Wants ALL OF THE ABOVE!</message>
  </stream_post>
  <stream_post>
    <post_id>666766307_106648356031318</post_id>
    <actor_id>666766307</actor_id>
    <target_id xsi:nil="true" />
    <message>Vince u make me smile! :)</message>
  </stream_post>
  <stream_post>
    <post_id>1384434612_108403085852041</post_id>
    <actor_id>1384434612</actor_id>
    <target_id xsi:nil="true" />
    <message>Getting excited about our next service this week at Lakepointe Church! Make plans to visit - http://LakepointeChurch.tv</message>
  </stream_post>
</fql_query_respon 

 

Mar 24, 2010 at 2:51 PM

That's weird how you get nothing.  Here's how I would call the first example you gave:

 

        Dim sb As New StringBuilder
        sb.Append("SELECT post_id, source_id, message ")
        sb.Append("FROM stream ")
        sb.Append("where source_id = " & iUserID & " Limit 10 ")
        Dim result = FacebookAPI(aspxPage).Fql.Query(sb.ToString)

        Dim mydataset As New Data.DataSet
        mydataset.ReadXml(New StringReader(result))

        If Not IsNothing(mydataset.Tables("stream_post")) Then
            Return mydataset.Tables("stream_post")
        Else
            Return Nothing
        End If

 

 

Mar 24, 2010 at 3:25 PM
Edited Mar 24, 2010 at 4:41 PM

How is FacebookAPI defined?

Does your sample work for you?

Like I said before if I test my queries here: http://developers.facebook.com/tools.php?api&app_id=2227470867 they work just fine, but not if I call them through the toolkit...

 

Am I the only one having this problem???

Mar 31, 2010 at 5:08 PM

I thought I would ping this one more time before abandoning it all together.  Apparently no one else has tried what I have tried or I have not been clear enough in explaining my issue.

Please, if anyone has successfully done what I am trying to do, could you respond?

Thanks,
John 

Apr 30, 2010 at 5:54 PM

John,

I am trying to do the same thing with the same results as you.  None of my queries return anything related to newsfeeds/wall and I do have data available now on both. 

I was about to try using the FB test console, but they (FB) has pulled that from their site with no explanation as to when it will be restored.

Did you finally have any luck with your queries...or did you throw the towel in (which I am about to do)?

Thanks.

Scott.

Apr 30, 2010 at 6:27 PM

Scott,

I never had any more luck.  I haven't given up entirely, but I moved on to another part of the site I am working on.  I thought maybe a few weeks away would give me a fresh perspective.  My best guess is that it has to be a bug in the toolkit.  All of my queries work precisely how I expect them to when I would run them from the FB Console (funny, I can't find it now either).

It is pretty frustrating to get past all of the *hard* stuff in order to connect your application to Facebook, only to have the seemingly easy part (writing queries) not work.  Please let me know if you figure anything else out!

John

Apr 30, 2010 at 6:42 PM

John,

I have given up for now on it too. Just like you, I expected the query stuff to be easy after getting my application to launch/behave correctly in FB….NOT!!!!

The only other approach that I might try is to perform all the connection/query tasks in ASPX page(s) with Javascript in order to eliminate the toolkit. If it works OK this way, then there are some definite issues with the toolkit. BTW…I have run into major issues with the de-serializing processes with the toolkit. They made some bad assumptions in how NIL’s are handled and I updated the source to resolve the issues I was having.

I will let you know if I get any further with the queries.

Thanks again.

Scott.

May 5, 2010 at 2:22 PM
Hi Scott, did you tested reading wall with javascript. I have the exact same problem you and John have. I cannot get valid results from fql. I have tried with FDT 3.1beta but result is same, fql does not return correct wall posts and some queries returns nothing at all.