Download all group files using Facebook Graph API - facebook

I was trying to use Facebook Grahpi API to download all files from FB group. I'm member of this group, and moreover I'm its admin.
The endopoint that I had been trying to use was
/v2.6/{group-id}/files
I'm working with Facebook Graph API Explorer so I don't have to pass access token manually. Additionally, my token has 'user_managed_groups' permission. Everything works quiet good with other endpoints, for example:
/docs, /members
Endpoint /files returns JSON with empty data array.
Does anyone know how to do it?

Related

How to get a page access token?

I want to generate a page access token with graph API 5.0 and don't know how to do.
I have an app, linked to a page which I am administrator, with all the permissions I need.
Everything works fine inside the graph API explorer.
The documentation says I need a user access token in order to get the page access token, using https://graph.facebook.com/v5.0/me/accounts?access_token=$user_access_token.
The problem is I don't know how to get it programmatically without having to confirm in the facebook popup. All I have now is the app access token, but this is an invalid parameter this endpoint.
Does somebody know where I'm wrong?

Which facebook access token to choose?

Which access token type should I use to make a light and secure Open Graph call, say to get the number of likes on certain URL?
The first solution that came to me was to generate a user access token with just a "public profile" permission via Open Graph Explorer and use that one. But it didn't work, and it will expire, so I would have to re-generate the token every time.
The other one solution is to use an application access token which doesn't expire:
app_id|app_secret
It seems redundant to me, quote the docs:
This can be used to modify the parameters of your app, create and
manage test users, or read your application's insights.
Why do I need to get so many privleges, if I just want to read some public data? And I don't want to expose my application to some possible malware intrusion in the case of a app_id and/or app_secret leak
The question is not only about how I can get the likes of certain URL, I guess it's more about how to use and manage access tokens wisely.
All Facebook Graph API endpoints are documented. From this documentation, you will be able to learn which action on which endpoint requires which type of access token, and which permission scopes.
To get "the number of likes on certain URL" you cannot use graph API. Neither the /?id=URL endpoint, nor the /OG-Object-ID endpoint that you can derive from the former give you back a like count.
For websites that you manage, Facebook Domain Insights might give you what you are looking for.

Retrieve a facebook secret group feed

I'm building a PHP application on a website to allow members of a secret Facebook group to retrieve all the YouTube links posted on the group wall. To do that I need to retrieve the feed of the group which I did using open graph. I generate an access_token thanks to graph API explorer and I managed to display the feed but it relies on the access_token which is eventually going to expire.
How can I do to be able to call the API's functions at any time with a valid access_token?
I was thinking about asking the visitors to connect with their Facebook account onto the application so that they can make a request with their own token.
Do you have leads on how I could do that?
Thanks i just created a dum app on facebook to allow oauth on my website and that did the trick.

Scrape a Facebook Group Document

background: My friend has a minecraft server with a white list. The community for that server is managed with a facebook group, and the white list is a facebook document within that group.
Currently the whitelist is managed manually from the facebook document, and we would like to automate the process, ie. run a script that automatically reads the document and generates a new white list
so far ive figured out that us can use the graph api and do a GET for https://graph.facebook.com/<doc-id>?access_token=...
and i was able to see the json object using the explorer tool
but the access token only seems to be valid for one user for one session, which means i would somehow have to provide my username/password and get a new access_token every time. that's the part where i'm not sure what to do.
Actually no, you can register you own Facebook app https://developers.facebook.com/apps and get an access token from the url
https://graph.facebook.com/oauth/access_token?client_id=ID&client_secret=SECRET&grant_type=client_credentials
Then, you can use this token for requests.

developers.facebook.com issued access token VS OAuth generated

Interesting problem I'm having right now.
Signing in an App gives a access token looking something like this:
AAACwFsGcSr4BAOGUTwfuZAWuUcwZC0rJ7noZCKMqhBI7ivDCsIGqduGIZCus5PRaS6KuREqxLmhfvZAZAkz5WCpFfANtUpYHgZD
This access token can't access users PUBLIC information, while one issued by Facebook on developers.facebook.com - CAN.
You can easily test this by logging to your facebook and going to this link: http://developers.facebook.com/docs/reference/api/
You'll see that Facebook automatically generates access token on DEMO urls like this one:
https://graph.facebook.com/me/music
?access_token=2227470867|2.AQCvlA_ZaJ2MfRR0.3600.1318266000.0-100001572415177|2FeweU6ZvOQS9OCF5ZBV58_PtPg
If you would change /ME/ to any user which has his MUSIC posted as public, you WILL be able to access that data with Graph API.
Now try to get an access token to your APP and call the same Graph API method with generated access token, the returned data is empty JSON object.
Whats’ the difference between these access tokens? How to obtain access token, that I could get public information using Graph API?
I was thinking that logging in your APP is the highest possible access token and the only higher token is token with specified permissions...
Any guidelines would be great :)
http://developers.facebook.com/docs/reference/api/permissions/
I believe the difference is that you can specify additional permissions in a scope parameter,
so if you wanted to read a user's feed you would have to specify read_stream. I was trying to accomplish this with an access token from a server-side authentication flow in ruby, but the access token only allowed to me to navigate accross a certain portion of graph.facebook.com/user_id/feed? requests. If you get any insights or comes across a solution shoot it my way too, if you can.