facebook test user no graph API search place result - facebook

I have created a test user for my app under development (not public yet), and using the access token generated for the test user to call graph API.
The graph API I am trying is search place (/search type=place distance=1000).
And I specify my current location as parameter.
However, I only get the following data in return:
{"data":[]}
If I specify distance=10000, I get a few place names, but this result is totally different from my result with ordinal (non-tester) user.
Using access token for non-test-user, I get 100s or more place names.
Question:
Why this difference?
Any setting needed for test user creation so that its graph API search result is the same as the ordinal user's?
(In case it is a limitation of test user, how I can test an app which use graph API, with a test user?)
Any help or clue is highly appreciated!

Related

Linkedin API get public-profile

I am trying to get the id from the public-profile-url. The query looks like:
https://api.linkedin.com/v1/people/url={https://www.linkedin.com/in/name}
However, what I get get back from linkedin is:
<error>
<status>400</status>
<timestamp>1460131755319</timestamp>
<request-id>2OV9FJ0DTR</request-id>
<error-code>0</error-code>
<message>[invalid.param.url]. Public profile URL is not correct,
{url=}; should be {https://www.linkedin.com/pub/[member-name/]x/y/z} or
{https://www.linkedin.com/in/string}</message>
The interesting part is:
Public profile URL is not correct, {url=}; should be {https://www.linkedin.com/pub/[member-name/]x/y/z} or {https://www.linkedin.com/in/string}
The url clearly adheres to the rules that they mention and the url works. Any idea on how to fix it?
You cannot reliably retrieve a member ID from a profile URL. id values that you can rely on are returned as part of Profile API calls. From time to time, LinkedIn changes the format of it's public profile URLs, so attempting to parse them or reconstruct them can leave your app in a broken state. The public-profile-url field should be considered read-only, and not something you try and parse or create yourself.
e.g.: GET https://api.linkedin.com/v1/people/~:(id,first-name,last-name,public-profile-url)?format=json
id values are encoded to specific LinkedIn applications and cannot be re-used between apps. As a result, any value you attempt to pull out of a URL won't be of any use to you. The information needs to be acquired via an API call.

Facebook graph api - Unsupported get request

I'm creating a custom module in Drupal, that for part of its functionality must fetch posts from a business page. So for simplicity, I'm using fbapp module as a dependency (drupal.org/project/fbapp), so that I can use it's authentication and request functions (fbapp_app_authenticate() and fbapp_graph_request()) without having to worry about the constant facebook graph updates making my own code obsolete.
I've created a facebook app, so authentication should be app token, using appid and app secret. This seems fine and I'm getting back access_token. However, when I try to read posts from a publicly available page (the clients), I get the response:
"Unsupported get request. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api"
Here's the queries and responses my code produces:
graph.facebook.com/oauth/access_token?client_id=<redacted>&client_secret=<redacted>&grant_type=client_credentials
array(1) {
["access_token"]=>
string(43) "<redacted>|<redacted>"
}
graph.facebook.com/<page_id>/posts?access_token=<redacted>|<redacted>"
string(183) "{"error":{"message":"Unsupported get request. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api","type":"GraphMethodException","code":100}}"
Can anyone verify a correct way to query a Facebook page programmatically, perhaps there's a setting in the page I'm querying that I need to set (although I can't find anything)?
If page restrictions apply, the page's feed can only be retrieved with an user access token as far as I know (because FB needs to evaluate the visibility criteria, and setting your app to the same restrictions doesn't help here):
See
https://developers.facebook.com/docs/graph-api/reference/v2.4/page/feed#readperms
It looks like everything you have done is correct. The response you got can be (i am not sure) because you got your clients pageid wrong.

How to get information from page facebook api graph

I have two examples:
Example 1:
https://www.facebook.com/cocacola
I get "likes","description" at https://graph.facebook.com/cocacola/
It work.
Example 2:
https://www.facebook.com/selectivefitness
I get errors at https://graph.facebook.com/selectivefitness/
Why example 2 does not working? How i can get "likes" "description" of https://www.facebook.com/selectivefitness
It's because of restrictions on the page (either country restrictions or age restriction). You just need a valid Access Token to fix it.
Try making a request to the URL using that Access Token. Something like:
https://graph.facebook.com/selectivefitness?access_token={Access_Token}
You can always make use of Graph API Explorer to test your requests and queries.

How can I export the feed from a group using Graph API?

I want to export the data of my Facebook group to some sort of file for historical purposes. I understand how to use the API but I don't know what I need to do to work with it. I can make queries in the explorer but it takes way to long for it to execute. I want to know what I need to do to export the data from my group into say a text file. Even just the basic steps in order to use the API would help. Thanks
You'll need to use one of the Facebook SDK's in order to programmatically access the Facebook API. Some popular ones are the JavaScript and PHP SDK's. The docs for each contain how to make API calls, and then you can use your code to handle the response to do whatever you want with them (as long as you stay within Facebook's policies).
An example of an API call in Facebook would be (after loading the SDK and having a valid login):
FB.api('/me', function(response) {
alert(response.name);
});
Let me know if that makes sense, or if you're still unclear how to approach API calls.
You have to get the feeds of the group first using graph api. Here is the code for that.
$groupFeeds = $facebook->api('/GROUP_ID/feed/?access_token='.$accessToken);
Note : $facebook is the object created of facebook class.
You have get the access token. Also you have should have the user_group permissions to extract the feeds of group.

Diffence between FQL query and Graph API object access

What's the difference between accessing user data with the Facebook Graph API (http://graph.facebook.com/btaylor) and using the Graph API to make a FQL query of the same user (https://api.facebook.com/method/fql.query?query=QUERY).
Also, does anyone know which of them the Facebook Developer Toolkit (for ASP.NET) uses?
The reason I ask is because I'm trying to access the logged in user's birthday after they begin a Facebook Connect session on my site, but when I use the toolkit it doesn't return it. However, if I make a manual call to the Graph API for that user object, it does return it. It's possible I might have something wrong with my call from the toolkit. I think I may need to include the session key, but I'm not sure how to get it. Here's the code I'm using:
_connectSession = new ConnectSession(APPLICATION_KEY, SECRET_KEY);
try
{
if (!_connectSession.IsConnected())
{
// Not authenticated, proceed as usual.
statusResponse = "Please sign-in with Facebook.";
}
else
{
// Authenticated, create API instance
_facebookAPI = new Api(_connectSession);
// Load user
user user = _facebookAPI.Users.GetInfo();
statusResponse = user.ToString();
ViewData["fb_user"] = user;
}
}
catch (Exception ex)
{
//An error happened, so disconnect session
_connectSession.Logout();
statusResponse = "Please sign-in with Facebook.";
}
The Graph API and FQL are similar in that they both access the same underlying Facebook objects: the nodes that are collectively referred to as "the social graph". The Graph API is a simple, uniform, and fairly direct way to access these objects. If you know exactly what you're looking for, the Graph API is a simple way to get it.
FQL, on the other hand, is a query language (like SQL). It allows you to search for graph objects that would be impossible (or complicated) to find using the simple, direct Graph API.
Another big feature FQL has over the Graph API is the ability to batch multiple queries into a single call (which can save you a lot of time in roundtrips for multipart queries).
Ultimately, the Graph API seems a more direct representation of what's going on "under the covers" in the social graph, so I find it simpler to use when I can. But if my Graph API request is getting really long or incomprehensible (or any time I need to make more than one related query of the social graph), that's the sign that it's time to switch over to FQL.
It seems the reason I couldn't get the birthday and other information I was looking for was because I didn't have a complete list of all the extended permissions that could be requested. I finally found the list at http://developers.facebook.com/docs/authentication/permissions (which included user_birthday).
If anyone has info about the FQL vs. Graph Object question, I'd still be interested in that. Though I think they are basically the same thing.
Looks like that have changed it (yes yet again). Because you are using facebook connect, you can ask for the permissions to give you the needed info for example user's birthday something like:
<fb:login-button perms="email,user_birthday"></fb:login-button>
More Information:
http://developers.facebook.com/docs/guides/web#login