0

I'm building a Facebook canvas app in Rails, and I'm looking to display all of the photos in a given photo album. I can generate the URL that will take me to a page with a JSON feed of the data associated with those photos, but I'm not clear on how to capture that information and store it in an array within Rails. If anyone could help me I'd appreciate it!

The request I'm making is to:

https://graph.facebook.com/'+album["id"].to_s+'/photos/?fields=source&access_token='+@token["oauth_token"]

Where album['id'] and @token[oauth_token] are user specific.

6
  • Usually you capture the data into a model you've created. Is there something exotic here you're not describing? Commented Oct 15, 2012 at 15:50
  • Nothing exotic - all I'm doing is grabbing the cover images of each of the user's albums with the intention that, when the user clicks the image, they'd be taken to another page with all of the images from that album present. I just don't have a lot of experience with JSON, especially not within Rails. Commented Oct 15, 2012 at 15:56
  • stackoverflow.com/questions/1826727/… Commented Oct 15, 2012 at 16:25
  • Could you please update how your request will be so that I can write the logic to parse the JSON and store data into the database? Commented Oct 15, 2012 at 16:43
  • @soundar I've just updated, is that what you need? Commented Oct 15, 2012 at 17:01

1 Answer 1

1

If you have a JSON string var_json_string, you can convert it to a Hash by doing:

JSON.parse(var_json_string)
Sign up to request clarification or add additional context in comments.

1 Comment

Cheers, the problem I was having was with using the net/http gem, I couldn't catch the response from that address, but I've found HTTParty, and that solved my first issue. Your answer then helped with the rest!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.