Accessing users friends work history using GRAPH API 2.3 - facebook-graph-api

How can I get the users friends work history? Currently I tried this in the Graph api explorer:
GET /me/taggable_friends?fields=id,name,work&acess_token...
and the query returns the friends, but don't show any job.
The response returns me somethin like this:
"data": [
{
"id": "<some-long-string>",
"name": "<name>"
},
I tried to do this:
GET /<the-some-long-string>...
And the response says me that the user id is incorrect. Googling I didn't found anything :'(
Thank you!!!

From Facebook Developers:
"message": "(#10) To use taggable_friends on behalf of people who are
not admins, developers and testers of your app, your use of this
endpoint must be reviewed and approved by Facebook. To submit this
feature for review please read our documentation on reviewable
features: https://developers.facebook.com/docs/apps/review"

Related

How do I get instagram_basic permission during development?

I'm trying to use this endpoint from the Instagram graph api:
GET /ig_hashtag_search?user_id={user-id}&q={q}
Documentation for this endpoint can be found here.
I'm running this GET request:
https://graph.facebook.com/v14.0/ig_hashtag_search?q=coke&transport=cors&user_id=<my_user_id>&access_token=<my_access_token>&q=coke
and get this as response:
{
"error": {
"message": "(#200) Requires instagram_basic permission to manage the object",
"type": "OAuthException",
"code": 200,
}
}.
The user id comes from my instagram account and the access_token that I'm using is a User token generated with "Graph API explorer" and I can see that this token has the scope "instagram_basic" when using the "Access Token Debugger".
I can't understand why this does not work? Do I really need to submit a API review just to test the hashtag endpoint during development?
Please help!
I guess sometimes App review team of Facebook doesn't know what is the usage of the permission so they just decline the submissions randomly. I got that permission like 3 months ago and i checked my app review. I send them this text
We are going to use instagram_basic to read an Instagram account profile's info and media. We will get the basic metadata of an Instagram Business account profile like "USERNAME", "ID", "FOLLOWERS", "FOLLOWING". You can check the Screescast to see how we use the instagram_basic on our app.
Here is what they saw while they do the app review
Also be careful while you send requests, keep in mind to change it to development mode. Some of the endpoints works only in live mode. The API still changes a lot and there are tons of bugs i see in my project. I hope this helps.

Facebook Graph API: Ban user function for pages doesn't work

I need to have the ability to ban users in page via API. I use next request:
POST
/page_id/blocked
data: user=user_id
It was working earlier. But now is not working. Currently I get error:
"message": "(#100) Required parameter user was not provided",
"type": "OAuthException",
"code": 100,
The documentation still: https://developers.facebook.com/docs/graph-api/reference/v2.9/page/blocked
How to make it work?
I had to change two things in order to make it work:
As the user ID came from my app, it is considered an 'app-scoped ID' (asid)
For blocking, the expected parameter is an array of IDs
POST 123pageid456/blocked?asid=[123userid456]
I got the same error, and filed a Facebook bug: https://developers.facebook.com/bugs/700023220191487/
It turns out the API does not currently support page-scoped IDs from the messenger platform. Only page IDs for the Facebook page.

why does posting to facebook page yield "user hasn't authorized the application"

I have read the fb docs and written code to publish a message to a facebook "page", however I am getting an error that I don't expect to see:
(#200) The user hasn't authorized the application to perform this action
Here's what I've done:
I set up a facebook application, which provides my APP_ID and
APP_SECRET.
I set up a test facebook "page". Let us refer to its fb id as PAGE_ID.
Used OAuth to get a USER_ACCESS_TOKEN with scope "publish_actions,manage_pages" for the user. I accepted the permissions requested by my app when redirected to the facebook auth page.
I did a GET on https://graph.facebook.com/me/accounts using the USER_ACCESS_TOKEN, and I get back a list of pages I administrate, including the one I want to post to.
This block of data for my page looks like:
{
"data": [
{
"category": "Community",
"name": "My Generic Test Page",
"access_token": PAGE_ACCESS_TOKEN,
"id": PAGE_ID,
"perms": [
"ADMINISTER",
"EDIT_PROFILE",
"CREATE_CONTENT",
"MODERATE_CONTENT",
"CREATE_ADS",
"BASIC_ADMIN"
]
},
....
]
}
Then I use the PAGE_ACCESS_TOKEN to post a message to the page:
I did a POST on https://graph.facebook.com/PAGE_ID/feed with a field message equal to This is a test post.
Facebook returns:
{
"error": {
"message": "(#200) The user hasn't authorized the application to perform this action",
"type": "OAuthException",
"code": 200
}
}
Using the token debugger, I can confirm that my PAGE_ACCESS_TOKEN is valid, and has scopes: manage_pages and publish_actions.
Where am I missing authorizing the application? Do I need additional scopes? Did I miss clicking something on the facebook authorization screen? Is there a setting on the app I am missing? After days of debugging this, I must be blind to the problem. :-|
You should add permission called status_update, for example
https://www.facebook.com/dialog/permissions.request?_path=permissions.request&app_id=145634995501895&redirect_uri=https%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html%3Fdisplay%3Dpage&response_type=token&fbconnect=1&perms=status_update&from_login=1&m_sess=1&rcount=1
and i'm able post to page i liked with the access token i get just now:
If you want to post as the admin of the page, you're require both manage_pages and status_update permissions, for example
https://www.facebook.com/dialog/permissions.request?_path=permissions.request&app_id=145634995501895&redirect_uri=https%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html%3Fdisplay%3Dpage&response_type=token&fbconnect=1&perms=manage_pages%2Cstatus_update&from_login=1&m_sess=1&rcount=1
Cheers
status_update is not used anymore. To publish on pages, I had to use both manage_pages and publish_pages.
Well, this seems to be a common mistake that most of us make while trying to do an activity in social netwroks. Before trying to put up an open graph action,You need to set the permissions in your initial authorization request . By default you only gain 'read-only' access to their basic information.
Settintg up permisson at teh time of authetication is a must for Facebook and LinkedIn APIs..
See the public_actions section in Facebook open graph permissions here and make relevant changes in the authorization code , and get your issue solved.
I found the best way to get a valid token and check permissions was via the Graph API Explorer BUT while Facebook's documentation is extensive it is not always the easiest to follow.
In the explorer you have to look at both:
The Application Currently at the top and quite subtle, I missed this for ages.
Get Token Dropdown What you click to get a Token, when you click the arrow you can choose pages and other items you have access to for selecting a token for.

like photo from graph api explorer

I am trying to like a friends photo for some preliminary research on a website feature and I'm finding strangeness in the graph api explorer. I have the publish stream option checked. But when I set the dropdown to POST and set the URL to IMAGE_ID/likes, it reports:
{
"error": {
"message": "Trying Too Often: You are attempting this too often. Please try again later.",
"type": "OAuthException",
"code": 368
}
}
and then I am immediately logged out of facebook. Would a kind soul be willing to try to like a friend's photo through the Graph API explorer and see if it works?
Sure, pass the URL and I'll see what happens.
Tested it with a pic from a friend of mine, worked like charm...

Access_token for graph api calls in JavaScript

I am trying to pull in and display the wall posts and comments from a public Facebook page on my client's webpage using JavaScript. I know I need an access_token, but the problem is it expires every so often. It seems I would need to dynamically get the access_token to avoid that issue. Does anyone know of a way to do this client-side?
Short answer:
If the page is really public, you don't need an access token at all. For instance,
http://graph.facebook.com/19292868552
{
"id": "19292868552",
"name": "Facebook Platform",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-ash2/276791_19292868552_1958181823_s.jpg",
"link": "http://www.facebook.com/platform",
"likes": 3922010,
"category": "Product/service",
"website": "http://developers.facebook.com",
"username": "platform",
"founded": "2007",
"company_overview": "Facebook Platform enables anyone to build social apps on Facebook and the web.",
"mission": "To make the web more open and social.",
"about": "We're building the social web. Get the latest here: developers.facebook.com ",
"talking_about_count": 74536
}
Longer answer, if you are using a particular user's access token to perform actions on their behalf, you might consider asking for "offline access" so that the token won't expire. See https://developers.facebook.com/docs/reference/api/permissions/ for more information about how to ask for this permission.