Adrian
Adrian

Reputation: 2012

How to display actual images of facebook photos using only id (graph API)

I am using the facebook graph API to get photos.

        FB.api(
                "/me/photos",
                function (response) {
                    if (response && !response.error) {
                        console.log(response);
                    } else {
                        console.log(response.error);
                        alert(response.error);
                    }
                }
        );

The only information Im getting back for each photo in the data object is created_time, id, and name so Im not sure how to buid displayable images out of this data.

I have tried this answer to try use the id to get the actual photo url but it is only giving back the same information there.

Does the permissions have an affect on the data that you receive back? As I am still in the submission process for this. I just assumed it would work anyway but give a permissions warning at the top of the pop up.

Upvotes: 0

Views: 231

Answers (1)

Tobi
Tobi

Reputation: 31479

You have to explicitly specify which fields you want to receive starting with v2.4. For example

/me/photos?fields=id,link,images

See

Declarative Fields
To try to improve performance on mobile networks, Nodes and Edges in v2.4 requires that you explicitly request the field(s) you need for your GET requests. For example, GET /v2.4/me/feed no longer includes likes and comments by default, but GET /v2.4/me/feed?fields=comments,likes will return the data. For more details see the docs on how to request specific fields.

Upvotes: 2

Related Questions