2

When making a query to get event details I seem to get venue.name instead of venue.id in the result set. Has there been an unannounced change in the table structure or am I doing something wrong. The Graph API Explorer gives the venue.id yet when using FQL through PHP SDK in my own web site it's the venue.name I get.

Heres the code:

$fql='{
"event_info": "SELECT name,description, pic_small,pic_big, eid,venue,location FROM event WHERE eid ='.$_GET['id'].'", 
"event_venue":"SELECT name, username, page_id, location FROM page WHERE name IN (SELECT venue.id FROM #event_info)"
}';

    $setup  =   array(
    'method'    => 'fql.multiquery',
    'queries'     => $fql,
    'callback'  => ''
    );

    $result   =   $facebook->api($setup);

This leads to the "event_venue" result set to be empty.

Here's the dump:

Array
(    
    [0] => Array
         (
            [name] => event_info
        [fql_result_set] => Array
            (
                [0] => Array
                    (
                        [eid] => 410351692336116
                        [venue] => Array
                            (
                                [name] => Boothill 
                            )

                        [location] => Boothill
                    )

            )

    )

[1] => Array
    (
        [name] => event_venue
        [fql_result_set] => Array
            (
            )

    )

)
CBroe
  • 91,630
  • 14
  • 92
  • 150
  • Can you do a `var_dump` of `$result` and show us what exactly it contains? (Relevant parts; and please update your question with that info, because inside the comments it will get hard to read.) – CBroe Aug 08 '12 at 07:11
  • Dump added with relevant parts. – Miika Salminen Aug 08 '12 at 07:54

2 Answers2

2

If I test this query

SELECT name,description, pic_small,pic_big, eid,venue,location
  FROM event WHERE eid ='410351692336116'

using the FQL tab (!) in the Graph API explorer, I get

"venue": {
  "id": 126049334121592
}

and not the venue’s name.

And doing a multiquery like your’s with the second query being

"event_venue":"SELECT name, username, page_id, location FROM page
  WHERE page_id IN (SELECT venue.id FROM #event_info)"

I’m getting the venue info as well.

Could you please check if you get a different result if you do your queries not using your $setup array with

'method'    => 'fql.multiquery',

but just

$facebook->api('/fql?q='.urlencode('{ "event_info": "…", "event_venue": "… FROM page
  WHERE page_id IN (SELECT venue.id FROM #event_info)" }'));

instead?

CBroe
  • 91,630
  • 14
  • 92
  • 150
  • No change. It gives the venue.name still. And yes the FQL tab in the Graph API explorer it has always given the venue.id as it should. – Miika Salminen Aug 08 '12 at 10:26
  • Strange. This return anything for you when used with the Graph API Explorer app? https://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3D%7B%22event_info%22%3A%20%22SELECT%20name%2Cdescription%2Cpic_small%2Cpic_big%2Ceid%2Cvenue%2Clocation%20FROM%20event%20WHERE%20eid%20%3D'410351692336116'%22%2C%22event_venue%22%3A%22SELECT%20name%2Cusername%2Cpage_id%2Clocation%20FROM%20page%20WHERE%20page_id%20IN%20(SELECT%20venue.id%20FROM%20%23event_info)%22%7D – CBroe Aug 08 '12 at 11:23
  • Both the Graph API & FQL Query explorers return exactly what they should. Only when I run FQL queries on my own page it changes the venue id to the name. Really strange. – Miika Salminen Aug 08 '12 at 12:22
  • Maybe an access token issue …? – CBroe Aug 09 '12 at 10:06
  • Well in the end it just seems to return id for some venues and name for others. So I'll just offer venue data when the id is available. – Miika Salminen Aug 09 '12 at 10:25
0

I've run into this issue today and spent quite some time troubleshooting it. It seems to be related to the Access Token. When I use my App's Access Token to request the venue data, for some venues all I I get is the venue.name field. However, if I use the Graph API Explorer to generate a different token, I get the venue.id field as expected.

I went as far as to replace the Graph API Explorer's generated Access Token with my App Token, and sure enough all I received back was venue.name.

Andrew Craswell
  • 674
  • 1
  • 6
  • 17