Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FB Graph API: Way to get list of fields for an object through API

Is there a way how to get the list of fields for a specific facebook object programmatically?

I know there's documentation for that, but I need some introspection - we're building a tool that would enable the user to select from existing fields.

I mean something like: give me a list of fields for user, response: {"id", "name", "first_name", ...}

Or some way how to get all the fields for one object and derive it from that?

like image 627
pcv Avatar asked Apr 19 '13 00:04

pcv


People also ask

How do I get data from Facebook Graph API?

Open the Graph Explorer in a new browser window. This allows you to execute the examples as you read this tutorial. The explorer loads with a default query with the GET method, the lastest version of the Graph API, the /me node and the id and name fields in the Query String Field, and your Facebook App.

How do I get a list of Facebook API pages?

Call the Graph API - https://graph.facebook.com/me/accounts. You can test this procedure in the graph explorer -> Just click on 'Get Access Token' button-> under 'Extended permission' check 'manage_pages' & submit it. It will give you the admin-page-details JSON.

What 3 terms does Facebook use to describe what the graph API is composed of?

The Graph API is named after the idea of a "social graph" — a representation of the information on Facebook. It's composed of nodes, edges, and fields.

Which type of Facebook post data can be extracted with the help of Apis?

The Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.


1 Answers

Facebook enables you to pass metadata=1 parameter. For example

cocacola?metadata=1

gives you all available connections and fields for the page:

  "metadata": {
    "connections": {
      "admins": "https://graph.facebook.com/cocacola/admins",
      "admin_settings": "https://graph.facebook.com/cocacola/admin_settings"
    },
    "fields": [
      {
        "name": "id",
        "description": "The Page's ID. No access token or user `access_token`. `string`."
      },
      {
        "name": "name",
        "description": "The Page's name. No access token or user `access_token`. `string`."
      },
      {
        "name": "link",
        "description": "Link to the page on Facebook. No access token or user `access_token`. `string` containing a valid URL."
      },
      {
        "name": "category_lists",
        "description": "The Page's categories. No access token or user `access_token`. `string`."
      },
      {
        "name": "is_published",
        "description": "Indicates whether the page is published and visible to non-admins. No access token or user `access_token`. `boolean`."
      }

Looks like it's official, found it in the getting started manual

like image 59
pcv Avatar answered Oct 09 '22 21:10

pcv