Facebook API (v3.2) - fan_count returns 0 using page access token - facebook

Request:
GET /v3.2/565231620165956?fields=fan_count,username
Response:
{
"fan_count": 0,
"username": "shirleysetia",
"id": "565231620165956"
}
Page access token used.

Related

Logout - Taleo User

I'm accessing the taleo api. I'm able to open the connection with the hosturl, username and password. But when I try to close or logout the session am unable to do it.
I have opened up the 20 connections now.
How to reset all those connections now?
Logout Request :
POST https://abc.tbe.taleo.net/xxxxx/ats/api/v1/logout
Logout response :
{
"response": {},
"status": {
"success": false,
"detail": {
"errormessage": "Login session for token null is expired or invaid.",
"error": "Login session for token null is expired or invalid.",
"operation": "internal",
"errorcode": "500"
}
}
}
Finally I got the answer. We need to add the authorization token as the cookie like follows .
add in the Header :
Cookie authToken="authorization_token"
Note: authorization_token between quotes

Facebook graph api - Cannot create offers

I am using the facebook graph api to programmatically create offers on a page, of which the user is an admin of.
I am sure the user is an admin of that page, still I am getting an error to check my admin permission levels (Error below). Any idea why? Any help is appreciated.
If it is of any help, I have added the following scope to my requests: {scope: 'manage_pages,publish_pages'}
{
"error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_subcode": 1528104,
"is_transient": false,
"error_user_title": "Check Your Admin Permission Level",
"error_user_msg": "Only some admins of your Page are able to create and edit offers. Talk to the person responsible for your Page about your admin permission level.",
"fbtrace_id": "FgBVmH5BTW0"
}
}
A snapshot of my code is as follows:
accessToken = req.session.access_token;
FB.setAccessToken(accessToken);
FB.api("page-name", {fields: "access_token,id"}, function (res) {
var pageId = res.id;
var pageAccessToken = res.access_token;
FB.setAccessToken(pageAccessToken);
FB.api(pageId + "/offers", 'post', {
title: "Test title",
expiration_time: 'some datetime',
message: "Test offer 1"
}, function (res2) {
resp.send(res2);
});

Cannot delete Facebook some test users

When I call:
$ curl 'https://graph.facebook.com/v2.2/<APP_ID>/accounts/test-users?access_token=<APP_ACCESS_TOKEN>&limit=500'
I see 82 accounts, and all but one look like this:
{
"id": "1413484435585065",
"login_url": "https://developers.facebook.com/checkpoint/test-user-login/1413484435585065/"
}
That is, they have no access token.
When I try to delete them I get:
$ curl -XDELETE 'https://graph.facebook.com/v2.2/1413484435585065?access_token=<APP_ACCESS_TOKEN>'
{
"error": {
"message": "(#100) Invalid value specified for param: id",
"type": "OAuthException",
"code": 100
}
}
The only one that DOES have an access token returns:
{
"error": {
"message": "(#2904) You cannot delete the Open Graph Test User for your app.",
"type": "OAuthException",
"code": 2904
}
}
If I go to Roles...Test Users on the Developers page of the app, then it is empty!
Any new test users I create I can see on the Developers page, and I can delete them using the mentioned curl call.
Where could these test users come from, and how do I get rid of them? Or at least filter them when I am listing test users.

FQL NoIndexFunctionException error 605 on an indexable column

I'm attempting:
SELECT developer_id FROM app_role WHERE application_id='MY APP ID'
Using a valid token, checked using https://developers.facebook.com/tools/explorer
I receive this back:
{
"error": {
"message": "Invalid application_id in WHERE clause",
"type": "NoIndexFunctionException",
"code": 604
}
}
Now. the application_id is definitely correct. The auth token is checked and associated with that app id, and as far as I can see application_id is totally indexable.
Any ideas what the grief is here? Thanks.
That's because you need an app access token. Get it this way:
GET https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID
&client_secret=YOUR_APP_SECRET
&grant_type=client_credentials
Source: https://developers.facebook.com/docs/opengraph/howtos/publishing-with-app-token/
Then, use the same FQL request:
SELECT developer_id FROM app_role WHERE application_id='MY APP ID'
And there you go:
{
"data": [
{
"developer_id": "1234567890"
},
{
"developer_id": "9876543210"
}
]
}

Facebook API How To Get All Pages I Like Without Pagination

If I like more than 100 pages/things, FB.API('me/likes') returns 99 items and a link to the next paging.
Is it possible to get ALL without the pagination?
Thanks
Have you tried /me/likes?limit=999 ?
You may still need to paginate, but you should be able to get more than 99 items in a single call
Use FQL:
$fql = "SELECT page_id from page_fan where uid = me())";
$pages_i_liked = $facebook->api(array(
'method'=> 'fql.query',
'access_token' => $access_token,
'query'=> $fql,
));
print_r($pages_i_liked);
Get All facebook pages of a user using facebook api
required permissions: manage pages
type: GET
url: https://graph.facebook.com/me/accounts
param: access_token
responce of the above request like this
{
"data": [
{
"category": "Book",
"name": "Mind blowing books",
"access_token": "CAACEdEose0cBAFRU2j0rGgNxBcJvU0pkZCpDbI7rZCJNmO2cZAfZBXoejoZCdTVdKi4gNCyBuu9fPRnWRAwCKrmkPePzKHoE5e46Jz7gRDYe3PM5ECm0ZC5OZB2iWLeEh3OZBgTGfWDmQbbFivwlp5v2umc0CcC9JlTvHsWDnTZCkKIbZAJeD2nOus1ZCCXMqSXHOAZD",
"perms": [
"ADMINISTER",
"EDIT_PROFILE",
"CREATE_CONTENT",
"MODERATE_CONTENT",
"CREATE_ADS",
"BASIC_ADMIN"
],
"id": "618353601555775"
}
],
"paging": {
"next": "https://graph.facebook.com/100000328561058/accounts?access_token=CAACEdEose0cBADKMTNRBl5pjNhw8xsKnQf57XKShV7UlhGyJy67bBZCUKkepl9rELlxqq0I474f8LEPGnt51Mdgs0MMtgTycuUgkOyRnLgVypWVpBd7oKy3LXrrbsQWSdIUZBU4qKHLxSb14TP8ySOaZChLseseYMr1YMLG3qrJiWLuwWJeVz2PeE8TmkkZD&limit=5000&offset=5000&__after_id=618353601555775"
}
}
Post at specific facebook page of a user using facebook api
required permissions: piblish action
type: Post
url: https://graph.facebook.com/{PAGE_ID}/feed
param: access_token, message
this http request will write your message on fb page
PAGE_ID: its page id which is in responce of first request
The maximum results limit is 100
"I just noticed this while counting the results and also next page query, if I insert limit 999 for example, the exact results will be shown as 100 and the next link generated by facebook will contain the limit value also 100"
With this class from Github: FacebookLikedPagesAPI you can get all ID liked pages on Facebook without pagination
$access_token = '';// your access token here
$likes=new Likes();
$result=$likes->getAllLikedPages($access_token);