Gem Koala Facebook API get_object request

[亡魂溺海] 提交于 2019-12-06 07:57:25

Although it is not very well documented, I read the code of the gem.

Here it explains how to do what you want.

You can do it like this:

Koala::Facebook::API.new(ACCESS_TOKEN).get_object(:me, { fields: [:birthday]})

This will return the birthday and the id of the user.

birthday is not an endpoint like friends, it´s just a field in the user table. Same for name, first_name and last_name:

/me?fields=name,birthday,first_name,last_name

I have no clue about Ruby and Koala, but i assume you can add the fields parameter as object - this is what it looks like in the docs:

@graph.get_object("me", {}, api_version: "v2.0")

Source: https://github.com/arsduo/koala

I think this should do it!

rest = Koala::Facebook::API.new(access_token)
rest.get_object("me?fields=birthday")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!