Search code examples
facebook-graph-apifacebook-android-sdkfacebook-events

Get public events from Facebook Graph API via Android SDK


I'm trying to get public events from Facebook Graph API with the following code:

val request = GraphRequest.newGraphPathRequest(
        AccessToken.getCurrentAccessToken(),
        "/search",
        GraphRequest.Callback { response : GraphResponse ->
                Log.e("E", response.toString())
        }
)

val parameters = Bundle()
parameters.putString("q", "Toronto")
parameters.putString("fields", "city,state,country,description,id,start_time,end_time,name,place,street,zip")
parameters.putString("type", "event")
parameters.putString("limit", "25000")
request.parameteans = parameters
request.executeAsync()

But I'm getting an empty data array. When I change the "type" field from "event" to "place" then I actually get the data.

Why am I getting no data for the event?


Solution

  • https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#search-4-4

    You can no longer use the /search endpoint with the following object types:

    • event
    • group
    • page
    • user