Facebook API: Returning false data



  • So, anyone who has experience with Facebook's Graph API probably knows all about this problem, but for those who don't (which would have included me a few days ago), let me euclidate.

    Basically, once you go through the OAuth dance and authenticate the user, and they give your application permission, you can place calls into Facebook's Graph API, which is basically all data in the system. You can only access data for which you've been given permission, of course, but when it works, it works great!

    GET https://graph.facebook.com/me?access_token=...
    
    {
        "id": 100000123456,
        "first_name":"John",
        "last_name":"Smith",
        ...etc...
    }

    If you don't have permission, you get an error in their well documented error format:

    GET https://graph.facebook.com/me?access_token=...
    
    {
        "error":{
            "message":"You don't have permission stupid", //paraphrasing
            "code":1234
        }
    }

    Unless, of course, it looks like this:

    GET https://graph.facebook.com/me?access_token=...
    
    {
        "error_msg":"You don't have permission stupid",
        "error_code":1234
    }

    But hey, at least we can detect these.

    No, the REAL problem is that randomly, very rarely, the api will shit itself, and return a much less verbose error:

    GET https://graph.facebook.com/me?access_token=...
    
    false

    Yes, this is valid JSON. But, it's not a hash, which is what my code expects. So, I get a casting error when I try to cast bool to Dictionary<string,object>. Easy to hack around fix, but completely undocumented!



  • Could you define "Euclidate" for me? I'm curious.



  • @mott555 said:

    Could you define "Euclidate" for me? I'm curious.

    He meant "hallucinate."


  • Discourse touched me in a no-no place

    @mott555 said:

    Could you define "Euclidate" for me? I'm curious.

    It's what you do when you talk about geometry.



  • @mott555 said:

    Could you define "Euclidate" for me? I'm curious.

    This is not the word I was looking for. Moving on.



  • @pkmnfrk said:

    @mott555 said:

    Could you define "Euclidate" for me? I'm curious.

    This is not the word I was looking for. Moving on.

    Tough crowd!



  • It's like elucidate, but in three dimensions.


Log in to reply