2

Is it possible to limit the fields that are returned from Facebook's Batch request API using the JavaScript SDK? For example:

    FB.api('/', 'POST', {
        batch: [
            { method: 'GET', relative_url: 'me'},
            ...
        ]
    }, function (response) {
        console.log(response);
    });

The first method of the batch request above returns the full user graph. However, what if I only wanted to fetch a few fields (e.g. first_name and last_name). Something like this would be nice, but doesn't work:

        batch: [
            { method: 'GET', relative_url: 'me', fields: 'first_name,last_name'},
            ...
        ]
Johnny Oshika
  • 54,741
  • 40
  • 181
  • 275

2 Answers2

4

With some requests you can use the &fields= appended to the end of the url. like /me?fields=first_name,last_name

pmaruszczyk
  • 2,157
  • 2
  • 24
  • 49
Dustin Nielson
  • 1,264
  • 1
  • 8
  • 8
1

Use FQL queries to filter out certian fields your require... eg :

SELECT uid, name, first_name, pic_square FROM user WHERE uid = me()

this query will return the user_id, full name, first name and 50x50 pixel profile picture for the user that is currently connected...

Lix
  • 47,311
  • 12
  • 103
  • 131