6

有没有办法以编程方式获取特定 facebook 对象的字段列表?

我知道有这方面的文档,但我需要一些自省 - 我们正在构建一个工具,使用户能够从现有字段中进行选择。

我的意思是:给我一个用户字段列表,响应:{“id”,“name”,“first_name”,...}

或者以某种方式获取一个对象的所有字段并从中派生?

4

1 回答 1

8

Facebook 允许您传递 metadata=1 参数。例如

cocacola?metadata=1

为您提供页面的所有可用连接和字段:

  "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`."
      }

貌似是官方的,在入门手册中找到的

于 2013-04-19T18:09:56.407 回答