Search code examples
facebookfacebook-graph-api

Facebook graph how to set parameters for picture?


I want to get user picture URL, but instead i get image download. In facebook developer guide It says to set redirect parameter to 0 but i don't know how to set parameters in graph, i tried it in JavaScript to but i still get picture downloaded not the URL any example, how to set parameters?

Here is what i tried:

/me?fields=id,name,picture?redirect=0

It returns syntax error.

The simple request returns image download

me?fields=id,name,picture

This is the example result:

"picture": {
    "data": {
      "height": 50,
      "is_silhouette": false,
      "url": "https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=3008732859171455&height=50&width=50&ext=1587125741&hash=AeSgpchLcdbLL1Mt",
      "width": 50
    }
  }

Solution

  • /me/picture would be the correct endpoint, or /me/picture?redirect=false if you do not want to redirect.

    Source: https://developers.facebook.com/docs/graph-api/reference/user/picture/