I want to know the best way how to obtain the basic info of a foursquare location, so for instance the mayor, total checkins, profile picture,...
Important: I should be able to get this information without providing an oauth_token, and that exactly is my problem. The API demands a token, but I figured it should be possible to get the data without the token, because you can access places without authenticating.
E.g.: https://foursquare.com/v/whole-foods/49bc3b0af964a52020541fe3
The reason I want to do this, is because I want to make a facebook application which fetches the data for a locationbased facebook page and I don't want to demand the facebook users to login to foursquare first.
An alternative is webscraping, but that really is my last option.
Thanks in advance for your responses.
The "Venues Platform" allows you to access venue information through the API without an OAuth token. You can access all the information you're looking for, all you need to do is supply your Client ID and Client Secret when making a request to the /venues API endpoint.
Related
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.
Is it possible to use facebook-api without making any facebook app, just from Graph api?
So that I can ask people to share there facebook profile information(public or non-public) with me given that they have control over whatever information they want to share. In graph-api, the only way I know, is to ask people to get a access token and give me.
I wanted it to be a system generated request for permission and all they had to do is just hit okay or hit cancel and depending that I get response related to access-token.
and To make a working facebook-app I atleast need to have a website or android app or something else, which I don't have it yet.
I can't think of any working way.
No, you need Access Tokens for almost all API calls, and you can only get Access Tokens with an App - no matter which Access Token.
#luschn is right that you need Access Token to API Calls. You can easily create a new app using Facebook. Once you created an app, you can generate token, which can be used to make Graph API Calls.
Helpful Links:
App Create Link https://developers.facebook.com/apps
Get Token: https://developers.facebook.com/tools/explorer?method=GET&path=comment&version=v2.11
I implement some facebook related stuff and accessing graph api for that pourposes. But for implement Integration testing I need a simple strategy to get access_token. So I create test user for that. How could I get access_token only with server side involved, without including browser in the chain. Ideally I just need to exchange login/password to the token.
Correct workflow loooks like this:
According the correct answer, there is special tests users provided by facebook.
To to be able to tests system properly you need to do the following flow
Get application access token
Request application's tests user's via "GET /{app_id}/accounts/test-users"
Parse response and extract access_tokens for each user from that response.
You can't exchange the login/password for an Access Token, but you can create test users programmatically. Have a look here:
https://developers.facebook.com/docs/graph-api/reference/v2.0/test-user
https://developers.facebook.com/docs/graph-api/reference/v2.0/app/accounts/test-users
How to get an access token with the right permissions for a test User
https://developers.facebook.com/docs/graph-api/reference/v2.0/user/permissions/
Short answer: You canĀ“t.
Server side you can only get an App Access Token, Page Access Token or extend an existing Access Token.
So it depends on what you need to achieve, if you just want to get public stuff from a Facebook Page, even an App Access Token may be good enough. But you cannot create User Access Tokens server side.
It may be possible with real test users created via the Graph API itself though, see Tobis answer for links about that. But it is definitely not possible with username/password.
For this task I have already created my own facebook application to get the API key and secret key. Can anyone explain the next steps that should be done to
1) Read from facebook API
2) Write my own database
by using web services
Thanks in advance!
A high level answer:
I'm assuming you want to use the authorization code OAuth flow (this means you want Facebook users to give you access to their profiles so you can grab data from there). If so, you need to bring up a web server and an application that will run your users through the Facebook OAuth flow. In case you just want to access Facebook with your own credentials you don't have to have a web server, simply use the client credentials OAuth flow.
So, Once you have a valid access token, you simply make calls to Facebook API using this token. using Facebook Graph API is simply a matter of calling URLs and getting the data as JSON.
You can test-drive the API here.
BTW, according to Facebook's platform policy, you're only allowed to store Facebook data for caching purposes.
Let me know if this helps.
On the documentation page for Facebook Graph API there are a lot of example links such as https://graph.facebook.com/me/likes?access_token=SOME_AT
Could anyone explain how the access_token for these links are generated?
All I've read in the documentation were about getting access_token only for applications, but on that page everyone could get an access_token without one.
You can use the graph API to get public information. People set privacy settings on facebook, so to prevent social freaks from stalking you, they(fb) created Autorisation.What I believe is that on the documentation, they are generating the access token using the Developers App. You can generate this Access token by making an application and asking a user to Authorise your application to access his data using OAUTH dialogs. Usually people reading at developer.facebook.com have enabled the Developers app so it easily opens your information.
The Graph API as such allows you to
easily access all public information
about an object. For example,
https://graph.facebook.com/btaylor
(Bret Taylor) returns all the public
information about Bret. For example a
user's first name, last name and
profile picture are publicly
available.
To get additional information about a
user, you must first get their
permission. At a high level, you need
to get an access token for the
Facebook user. After you obtain the
access token for the user, you can
perform authorized requests on behalf
of that user by including the access
token in your Graph API requests:
The access_token in these links are generated using your Facebook identity and an application ID (presumable associated to "developers.facebook.com"). If you go to the same page with another Facebook account, you will see different access tokens.