Search code examples
facebook-graph-api

how to get facebook page creation date using facebook api


my try : https://graph.facebook.com/v12.0/{mypageid}?fields={fieldname_of_type_PageStartDate}

Could not get any response when using this api and i am also confused about {fieldname_of_type_PageStartDate} parameter value. i tried day,month,year value according to https://developers.facebook.com/docs/graph-api/reference/page-start-date/ this fb website but it didn't work.

please suggest any way to get facenook page creation date using api.


Solution

  • The documentation is a bit misleading, because what that page does not tell you on its own, is that those fields are part of the start_info property of the page - so you have to query that one.

    https://graph.facebook.com/v12.0/pageid?fields=start_info
    

    This will give you a structure of the following format:

      "data": [
        {
          "name": "...",
          "start_info": {
            "type": "Started",
            "date": {
              "year": 2021,
              "month": 11,
              "day": 29
            }
          },
          "id": "1234567890"
        },
    

    Not all sub-fields will always be set; you might for example encounter types Founded with only a year set, or Unspecified with no date info at all.

    Note that this is not the actual page creation date; but the "start date" of the entity represented by the page. So it must be explicitly set in the page settings, otherwise this field will be empty.