Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7515939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:58:19+00:00 2026-05-30T00:58:19+00:00

I want to access the Facebook Graph API and get JSON responses like this:

  • 0

I want to access the Facebook Graph API and get JSON responses like this:

{
  "data": [
    {
      "name": "Coldplay", 
      "category": "Musician/band", 
      "id": "15253175252", 
      "created_time": "2012-01-27T22:51:44+0000"
    },
    {
      "name": "R.E.M.", 
      "category": "Musician/band", 
      "id": "8759772983", 
      "created_time": "2012-01-27T22:51:43+0000"
    }
  ], 
  "paging": {
    "next": "https://graph.facebook.com/1000032123447/music?format=json&limit=5000&offset=5000&__after_id=8123918"
  }
}

Now I want to save the name, the category and id into my rails database.
I have got a table with the same columns.

What is the easiest way to save this response into the matching columns of the database? Or is there a better solution, i.e. just saving the whole json object into the database and read it later on in the code again?

If you have time, please provide a coding example for the javascript/jQuery (ajax maybe) and ruby code. Thank you so much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:58:20+00:00Added an answer on May 30, 2026 at 12:58 am

    See this question and answer for how to send JSON content from the browser to a Rails app.

    Then you can do something like this (the JSON will be parsed automatically, and available as the params hash). One thing to note, is that the id attribute in the JSON will be ignored, since it’s protected by default (Rails uses id as the primary key for records). Better to “rename it” to something like facebook_id:

    # POST /path/to/collection
    def create
      params["data"].each do |data|
        data["facebook_id"] = data["id"]
        SomeRecordClass.create(data)
      end
    end
    

    Of course you’ll want to do some error checking, send a response, etc.

    In the browser, you can do something like this, if you’re using jQuery

    $.ajax({
      type: "POST",
      url: "/path/to/collection",
      data: data, // the JSON data, as an object or string
      contentType: "application/json",
      dataType: "json"
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

could someone help me on this problem, i want to access facebook API through
I want to create a separate function to get specific data from Facebook graph
I've been trying to get Rails to play with the new Facebook Graph API.
I want to post an event to a facebook group using the graph API
I'm pretty new at this. I was playing with the Facebook Graph API and
I want to use facebook graph api to authenticate users on my webapp which
I want to get insights data of a facebook page. I have tried with
I want to use facebook's graph api to retrieve a page's photos. Here's the
I'm trying to use the Facebook Graph API to get the latest status from
This FQL multiquery, for example: https://graph.facebook.com/fql?q={posts:SELECT actor_id,message,permalink,created_time,comments.count FROM stream WHERE source_id=me(),actors:SELECT uid,name,pic_square,profile_url FROM user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.