Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

facebook graph api - search event

In the event search, the query searches only by the Event Name: sample http://graph.facebook.com/search?q=party&type=event

  • Is there a way to query the Event Description? Or other fields ?

I tried to use until or since, but i get the same results https://graph.facebook.com/search?q=party&type=event&until=today https://graph.facebook.com/search?q=party&type=event&until=yesterday

  • FQL only accept search by event ID
like image 401
Joao Franco Avatar asked Aug 26 '11 02:08

Joao Franco


People also ask

What data can I get from Facebook Graph API?

The Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.

Is Facebook Graph API deprecated?

Applies to all versions. Facebook Analytics will no longer be available after June 30, 2021. Additionally, we are deprecating the App Dashboard Plugin for Marketing API. For more information visit the Business Help Center.

How do you graph API on Facebook?

Go to Tools – Graph API Explorer to generate Access Tokens for various kinds of API that you would like to use in your app. Choose the app and kind of token you need in the drop down menus in the left part of the screen. Then click “Generate Access Token”.

Is Facebook Graph API RESTful?

Because the Facebook Graph API is a restful JSON API, you can run queries directly in any standard browser; you'd simply be making HTTP calls.


2 Answers

The search returns the id's for all events returned in the search. Using https://graph.facebook.com/search?q=party&type=event&until=today&fields=id you can loop the id results to https://graph.facebook.com/eventid?access_token=yourapptoken to get array of the event which will include the description, name, image etc;

Live Sample for Page & Event Search here: http://shawnsspace.com/plugins/plugins.searcher.php

Refer to: http://developers.facebook.com/docs/reference/api/event/

Example Code: Assumes PHP-SDK 3.1.1 is installed on page.

Events https://graph.facebook.com/search?q=conference&type=event


  <?php
    $qi = urlencode($_GET['qs']);
        if(!$_GET['qs']){
        $qi = urlencode($_POST['qs']);
            if(!$_POST['qs']){
        $qi = "party";
        }
    }
    $search = $facebook->api('/search?q='.$qi.'&type=event&limit=10');
       foreach ($search as $key=>$value) {
       $i=1;
          foreach ($value as $fkey=>$fvalue) {
          $i++;
          if($fvalue[id]=="h"){
          }else{              
            $id = $fvalue[id];
    $searchResp = $facebook->api('/'.$id.'');
            $name = $searchResp[name];
            $location = $searchResp[location];
           $desc = $searchResp[description];
            $sTime = $searchResp[start_time];
            $eTime = $searchResp[end_time];

               echo $name. '<br />';
               echo $location. '<br />';
               echo $sTime. '<br />';
               echo $eTime. '<br /><hr />';
        }
        };
    };
?>
<form id="getsearch" method="post" action="yourpage.php">
<input type="text" value="" name="qs" id="searchbox" onclick="this.value='';" style="padding: 2px;" size="48">
<input type="submit" value="Search" style="padding: 3px;">
</form>

like image 155
Reino Wis Avatar answered Sep 29 '22 08:09

Reino Wis


The search in Graph API for events is currently limited to the event name only; I don't believe there are plans to change this in the short term, unfortunately

like image 35
Igy Avatar answered Sep 29 '22 07:09

Igy