Reputation: 7279
I'm trying to using Koala gem to search for facebook page, like this
@graph.get_connection('search', movie_name)
but I got this /Users/luizeduardo/.rbenv/versions/2.2.3/lib/ruby/2.2.0/uri/generic.rb:1100:in rescue in merge': bad URI(is not URI?): /search/Jurassic World (URI::InvalidURIError)
Seems like I'm using the wrong method OR this is not possible
Upvotes: 1
Views: 663
Reputation: 1211
The Koala Wiki should say this:
@graph.search('koala', type: :place)
instead of this:
@graph.get_connection('search', type: :place)
Hopefully that gets you closer to a solution.
Upvotes: 0
Reputation: 1209
get_connection throws the same error for me as well (maybe because v2.6?).
anyway, i found that solution works:
@graph.get_object('search?q=YOUR_QUERY&type=page')
Upvotes: 1
Reputation: 11226
You're use of get_connection
seems like the incorrect method for doing a general search of public page data. get_connection
has more to do with FB friends network. For a more detailed understanding of what API calls Koala will make, have a look at the code which has good comments describing how each method works. For general API graph calls you can simply use the graph_call
method.
https://github.com/arsduo/koala/blob/master/lib/koala/api/graph_api.rb
You should be able to use the graph_call
method and pass in whatever api call you'd like to make as single parameter in a string.
fb = Koala::Facebook::API.new(ENV['FACEBOOK_CLIENT_TOKEN'])
lookup = fb.graph_call("search?q=star%20wars%20movie&type=page")
see similar question and answer here
Upvotes: 0
Reputation: 31479
Have a look at
You can also search for users/pages/events/groups for the keyword of your choice:
# http://graph.facebook.com/search?q=koala&type=place
@graph.get_connection('search', type: :place)
# => [{"category"=>"Attractions/things to do", ...
# "name"=>"Maru Koala & Animal Park"}]}
In your case this would mean
@graph.get_connection('search', type: :page)
IMHO...
See
Upvotes: 1