2

I'm trying to get the data at this url:

https://graph.facebook.com/me?access_token=(my access token)

When I go to this address in a browser, it works. But I'm trying to use the rest-client gem in Ruby on Rails like this:

url = 'https://graph.facebook.com/me/home?access_token=' + access_token
result = RestClient.get url
p result

But I get this error message:

URI::InvalidURIError in AuthenticationsController#index
bad URI(is not URI?): https://graph.facebook.com/me/home?access_token=(my access token)

What am I doing wrong here? Could it have something to do with the format of the access_token? I've left it out in the code above, but this is the format it's in:

1xxx

Thanks for reading.

ben
  • 29,229
  • 42
  • 124
  • 179

2 Answers2

1

Try escaping the access_token:

url = 'https://graph.facebook.com/me/home?access_token=' + URI.escape(access_token)
Zabba
  • 64,285
  • 47
  • 179
  • 207
0
r = RestClient.get 'https://graph.facebook.com/me/feed', :params => {:access_token => access_token }

You should do something like this

dalf
  • 582
  • 4
  • 11