开发者

Limit fields using JavaScript SDK Batch Request

开发者 https://www.devze.com 2023-04-02 06:59 出处:网络
Is it possible to limit the fields that are ret开发者_Python百科urned from Facebook\'s Batch request API using the JavaScript SDK?For example:

Is it possible to limit the fields that are ret开发者_Python百科urned 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'},
            ...
        ]


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


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消