Question

I want to get public facebook information such as

https://graph.facebook.com/http://www.google.com

when I do

@graph = Koala::Facebook::API.new
@graph.get_object("http://www.google.com")

I get

Koala::Facebook::AuthenticationError: type: OAuthException, code: 2500, message: Unknown path components: /www.google.com [HTTP 400]
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/koala-1.6.0/lib/koala/api/graph_api.rb:470:in `block in graph_call'

Why doesn't this work? and why is authentication needed if an access token is not needed for such request?

Was it helpful?

Solution

You need to escape some of the characters in the url, like this:

@graph.get_object("http%3A%2F%2Fwww.google.com")

Or you can use the CGI::escape method to do the escaping for you.

@graph.get_object(CGI::escape("http://www.google.com"))

OTHER TIPS

Generally Error Code 2500 is Permission Denied (You need to have an access token), but it's confusing as you are trying to access public info. Try using an application access token when accessing the data. For Generating an APP access_token send a GET request to this URL

GET https://graph.facebook.com/oauth/access_token? client_id=YOUR_APP_ID &client_secret=YOUR_APP_SECRET &grant_type=client_credentials

I hope this will help. Otherwise I have some more ideas.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top