How to get object by URL?
Hi!
I couldn't find a way to get object from Facebook graph by URL. I tried
graph = Koala::Facebook::API.new
graph.get_object("http://example.com")
but got Koala::Facebook::AuthenticationError: type: OAuthException, code: 2500, message: Unknown path components: /example.com [HTTP 400]
Response from Facebook graph for http://graph.facebook.com/http://example.com is:
{
"id": "http://example.com",
"shares": 178617,
"comments": 69567
}
Is there another way to do that in Koala?
Hi @dmilisic,
Sorry about the late response. What you're looks right to me -- it might actually be an encoding issue in Koala. If you're still seeing this, can you add Koala::Utils.logger.level = Logger::DEBUG, and paste back the log response that you're getting? I can investigate from there, especially if you can point me to a public URL to test this with.
Best,
Alex
Hi Alex,
here is the stack trace:
graph.get_object("http://example.com")
D, [2014-02-11T11:40:45.058835 #10522] DEBUG -- : GET: /http://example.com params: {}
Koala::Facebook::AuthenticationError: type: OAuthException, code: 2500, message: Unknown path components: /example.com [HTTP 400]
from /home/developer/.rvm/gems/ruby-2.1.0@test/gems/koala-1.6.0/lib/koala/api/graph_api.rb:470:in `block in graph_call'
from /home/developer/.rvm/gems/ruby-2.1.0@test/gems/koala-1.6.0/lib/koala/api.rb:57:in `api'
from /home/developer/.rvm/gems/ruby-2.1.0@test/gems/koala-1.6.0/lib/koala/api/graph_api.rb:468:in `graph_call'
from /home/developer/.rvm/gems/ruby-2.1.0@test/gems/koala-1.6.0/lib/koala/api/graph_api.rb:58:in `get_object'
Danijel
@dmilisic you can do graph.get_object('', id: url)
@RKushnir that helps, ty.
That's pretty awkward. I'll keep this flagged as an open issue.
see https://developers.facebook.com/docs/graph-api/reference/v2.8/url/
Cool, thanks, that's useful. This type of weird need fits the criteria for a convenience method, so I'll build one.
thank you very murch, it's exciting