facebook can_upload is false except for one album - facebook-graph-api

If I query "me/albums?fields=can_upload,name" with the graph explorer I only get can_upload true for one album (from a total of 13 albums)
my permissions (from the Access Token Debugger): create_note photo_upload publish_actions publish_stream share_item status_update user_photos video_upload
What am I missing?

Damn, got the solution.
I've initially set the permission for post visibility from that app to only me.
The album with can_upload true was only visible by me, too.

Related

Facebook access token is taking user_photos permission only for developer account

I want to get the albums from the Facebook in my app. I'm requesting the accessToken with email,user_about_me,user_photos permissions. While authenticating with the Facebook account in the pop window it is written as "app will receive the following info: your public profile, email address, photos and personal description.", this message is coming only for the developer account .
If I login through another account the pop up window text will be like this "app will receive the following info: your public profile and email address. ", there is no photos permission is coming in this message, as a result my accesstToken doesn't getting the albums of the user.
I made the app live for the public. I'm working on grails framework in groovy language
private static final String AUTH_URL = "https://www.facebook.com/dialog/oauth"
static def getLoginUrl() {
def params = [
response_type: "code",
client_id : CLIENT_ID,
redirect_uri : REDIRECT_URI,
scope : "email,user_about_me,user_photos"
]
def url = "$AUTH_URL?" + params.collect { k, v -> "$k=$v" }.join('&')
return url
}
EDIT: I just now created a new app in another facebook developer account and I used those credentials in my app. Then my app is getting albums from that devloper account only. It seems that it is working with the developer account. I checked all options age is anyone(13) , country option is also disabled.
Read about "Login Review" in the docs: https://developers.facebook.com/docs/facebook-login/review
Most permissions only work for users with a role in the App by default, you have to go through a review process with those.

Why Graph API Explorer doesn't return the wall 'feed' based on a user's id

When I test the Graph API Explorer from facebook site and write the following parameters:
https://graph.facebook.com/'userid'/feed?access_token='my access token'
it returns
{ "data": [ ] }
I tried it with several group ids and all return the same result.
scope is below
user_birthday, user_religion_politics, user_relationships, user_relationship_details, user_hometown, user_location, user_likes, user_education_history, user_work_history, user_website, user_managed_groups, user_events, user_photos, user_videos, user_friends, user_about_me, user_status, user_games_activity, user_tagged_places, user_posts, read_page_mailboxes, rsvp_event, email, ads_management, ads_read, read_insights, manage_pages, publish_pages, pages_show_list, pages_manage_cta, pages_manage_leads, publish_actions, read_audience_network_insights, read_custom_friendlists, user_actions.video, user_actions.books, user_actions.music, user_actions.news, user_actions.fitness, public_profile
when I tried it from facebook graph api explorer I found out that its not returning any results. Please I would really appreciate the your help
Can you tell me that you are accessing others id by the same token or you are taking a different token??
Because if you are using graph explorer then it will give the token for your ID only. And you can see all the feed of your page using
me/feed?fields=id,posts,from or
your_id/feed?fields=id,posts,from
Use GET request while using submit button.

Facebook Graph API: get the photos in an album of a group

Before I ask give some information which i am already able to achieve:
I'm able to get the group feed in JSON format
I am accessing a group. I have got a long lived access token and i could access the feed.
Inputs I have are: group_id, acess_token.
URL USED:
https://graph.facebook.com/v2.1/{group_id}/feed?access_token={access_token}
The URL gave JSON formatted output of all the posts etc.
I'm able to achieve the albums of the group
URL USED:
https://graph.facebook.com/v2.1/{group_id}/albums?access_token={access_token}
The URL gave JSON formatted output of all the albums (their IDs, name, etc.).
What I'm NOT able to achieve:
URL USED:
https://graph.facebook.com/v2.1/{album_id}/photos?access_token={access_token}
URL USED:
https://graph.facebook.com/v2.1/{album_id}?fields=photos&access_token={access_token}
URL USED:
https://graph.facebook.com/v2.1/{album_id}/photos?fields=picture,source,name&type=uploaded&access_token={access_token}
{
"data": [
]
}
I even tried the above in the 'Graph API Explorer', I get the same output.
I have tried for various group ids to see if some group ids may be the source of the problem. But I get the same output as shown above.
I have gone through all related questions on Stack Overflow. I am using the same URL formats as mentioned in the posts. They say that they can see the photos' data in JSON.
Due to permissions restrictions it is not possible to retrieve all photos from group albums unless the user uploaded those albums themselves.
The Graph API reference mentions that one of the following is necessary to retrieve a regular album:
Any valid access token if the album is public.
A user access token user_photos permission to retrieve any albums that the session user has uploaded.
Oddly, the /{group_id}/albums edge, is undocumented. Here's what I've learned from experience about accessing group albums:
A user access token with user_photos permission will allow access to album information and photos for albums that user uploaded.
Any attempt to access any album the user did not upload (including public albums in public groups) will return album data, but not photo information.
You were using the correct queries. For completeness I will restate them here.
Album information
https://graph.facebook.com/v2.1/{group_id}/albums?access_token={access_token}
Photos
https://graph.facebook.com/v2.1/{album_id}?fields=photos&access_token={access_token}
You can still access photo attachments (but not albums) off of /{group_id}/feed

FB.api doesn't bring profile name

I am using Facebook JS sdk to show news feeds. the app works well for many users for for some users who have authorized my app doesn't bring reasonable result.
I use following code to get basic profile info which works for some users but for some it doesn't:
FB.api('/' + id + '?access_token=' + access_token, function (response) {
var strTitle = response['first_name'] + " " + response['last_name'];
});
In response object I receive only id, birth date, email, profile link but name is not available. Interestingly when I open profile link in my browser facebook says:
"Sorry, this page isn't available
The link you followed may be broken, or the page may have been removed."
after that my code can bring its posts but again the from name of the posts is missing in response object. The permissions list is attached as picture.
I can't understand what is going on and how can i fix this issue. Any help please?
The problem is that you are using the App center permissions feature (previously known for Authenticated referrals).
Use these settings to enter the set of permissions your app requires when displayed in App Center
You should be passing a login url with the scope array of permissions in JS SDK.
FB.login(function(response) {
// handle the response
}, {scope: 'email,user_likes'});
or via a login button
<div class="fb-login-button" scope="email,user_likes" data-show-faces="true" data-max-rows="3">Login with Facebook</div

Facebook Graph API and FQL like count on photo's both incorrect?

Hey all,
I've made a facebook application for a contest, which allows users to upload their photo. Once uploaded, the photo gets posted to a dedicated album on their profile. Once the photo is there, the users should collect as many likes as possible.
Currently i have tried both the Facebook Graph API and Facebook FQL to retrieve the amount of likes, but the retrieved likes don't always match the likes on a users profile.
Some users claim to have more then 200 likes, yet the API only returned a maximum of 101 likes so far.
All users are requested to grant the application the following permissions:
user_hometown, publish_stream, read_stream, user_photos and offline_access
Using Facebook PHP SDK 3.0.1 I tried this FQL query to collect the amount of likes of a photo:
# fql query
$fql = "SELECT object_id FROM like WHERE object_id=" . $photo_id;
# api request
$request = array(
'method' => 'fql.query', 'query' => $fql
);
# run batch request
$likes = $this->facebook->api($request);
# return like count
return count($likes);
I also tried the following Graph API request (Also with Facebook PHP SDK 3.0.1) to collect the amount of likes of a photo:
$likes = $this->facebook->api($photo_id.'/likes');
return count($likes['data']);
Strangely, neither seem to return correct results. I can understand if the API is slightly inaccurate, but according to the API some pictures recieved 100 likes this morning and then 0 likes a few hours later.
Does anyone have any ideas what i might be doing wrong? Do the photo's and their albums need to be public? Do the people who liked the photo need to have a public profile in order to show up in the API? Do i need to request additional permissions?
Any help or suggestions will be greatly appreciated!
Just had the same problem here. The likes seems to be paginated by hundreds by default. Override this setting by using the "LIMIT" query option.
Does anyone have any ideas what i might be doing wrong?
yes, I believe that it is against Facebook policy to use their likes plugin for a contest. See: https://www.facebook.com/promotions_guidelines.php
# fql query
$fql = "SELECT like_info FROM photo WHERE object_id=" . $photo_id;
# api request
$request = array(
'method' => 'fql.query', 'query' => $fql
);
# run batch request
$likeInfo = $facebook->api(array(
'method' => 'fql.query', 'query' => $fql
));
var_dump($likeInfo);die;
=> get like info of photo