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?
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.
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With