Search code examples
facebookfacebook-graph-apifacebook-fql

Graph API:- Find whether a ID is pageid or groupid or userid using Graph api


I have started using Graph Api recently.Every thing was going good until I face this problem..

For a given ID I want to know to which type this id belongs to?

for example I want to know whether 99543192159 is page id or group id or user id

The ID which i have given is page id and I found it by checking it manually.

Is there any possibility to know the same thing with graph api?

Are there any tools for doing this? If yes any idea how they are doing?

Thank you!!


Solution

  • This can be done via the metadata property:

    GET /99543192159?metadata=1&fields=id,metadata{type}
    

    returns

    {
      "id": "99543192159",
      "metadata": {
        "type": "page"
      }
    }
    

    Try it yourself: