facebook - Like a page through API - facebook

I'd like my application to like a facebook page on behalf of the user with an API call.
I saw this part of the documentation and tried to make the following post request:
https://graph.facebook.com/101544000571/likes?access_token=MY_ACCESS_TOKEN
where 101544000571 is a page id and got the following error:
{
"error": {
"message": "(#3) Application does not have the capability to make this API call.",
"type": "OAuthException",
"code": 3
}
}
I thought it's a permission problem but the application (in this case it's the graph API explorer application) has all the permissions necessary.
What am I missing here?

You cannot like a page using the Facebook Graph API. It is not supported.
You can use the the Like button social plugin.
The doc mentions : "For Facebook Pages or websites that do not integrate with Facebook Authentication, developers should continue to use the Like button social plugin."

Related

An unknown error has occurred with graph Facebook

I have an element on my website which shows facebook posts from a page and the amount of views/likes/comments. This stopped working all of a sudden and I have no idea why.
If I make the request with the graph api tester tool I get:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "CIHVxFhXIv/"
}
}
This is the request link I use with file_get_contents:
https://graph.facebook.com/v3.0/idofmypage/posts?fields=comments,full_picture,likes,message,picture,story,permalink_url,updated_time,from,insights.metric(post_impressions)&access_token=myaccesstoken
Did something change again with permissions or maybe a field is deprecated?
According to this fb new the Pages API and others have changed, and now you can only access the data if it's a page of your own.
Pages API: Until today, any app could use the Pages API to read posts or comments from any Page. This let developers create tools for Page owners to help them do things like schedule posts and reply to comments or messages. But it also let apps access more data than necessary. We want to make sure Page information is only available to apps providing useful services to our community. So starting today, all future access to the Pages API will need to be approved by Facebook.
Today I've started a project wich, in the begging, I need to recollect data and that's what I've found about it..

Facebook Graph API | Page feed

I am having a problem with the facebook graph API, when I try to read a Page feed using graph../{pageId}/feed it works only for some pages. On other pages I get the following error:
{
"error": {
"message": "(#200) Requires extended permission: ads_management or manage_pages",
"type": "OAuthException",
"code": 200
}
}
The Page is restricted by location, as we found out in the comments. If it works for one user, most likely the other one is not allowed to view the page - which means that you can´t grab the feed with his User Token. The Page could also be unpublished, but i guess that´s not the case.
If you are unsure, try lifting the restriction and test it.
If that does not work, you should file a bug.

App Scoped Id - Link to Facebook URL

Previously - we were able to use the /account_id?acesss_token=APP_ACCESS_TOKEN to get the users information that authed in your app.
For the new v2.0 API, we get app_scoped_id where the folllowing method:
https://graph.facebook.com/v2.0/APP_SCOPED_ID?access_token=APP_ACCESS_TOKEN
Works for some users, but others - we get this:
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
}
Why would this function work for some users, but not others? We have no way to get the link property of the user to redirect them, nor does http:///facebook.com/SCOPED_APP_ID do anything or http://facebook.com/app_scoped_user_id/SCOPED_APP_ID work correctly. Anyone have advice to redirect the user to their FB profile via the FB Scope App ID?

unlike facebook page api

searched around on a way to unlike facebook fan page but no success
the only way i figure out is :
https://graph.facebook.com/me/likes?method=delete&url=http://www.facebook.com/FNAPAGE&access_token=
error :
{
"error": {
"message": "(#200) App does not have permission to make this call",
"type": "OAuthException",
"code": 200
}
}
so is there a way to unlike facebook fan page ? whatever if its through php or java api .
In the User object documentation, under the Likes connection there's nothing about changing/deleting or even adding likes, it just has a way of reading the user likes.
So as it looks, currently you have no way of automating this, and you'll have to manually go to each page you want to remove the like.
Facebook API v2, released April 30th, 2014, includes an end point for deleting a like.
https://developers.facebook.com/docs/graph-api/reference/v2.5/object/likes#delete

Gigya Integration Help Needed

I am trying to develop a new site using gigya for facebook integration
for that i have created a facebook application
then updated my gigya settings like app id and secret id
Grabbed the facebook login plugin code used in my html/jsp, and I am seeing the ‘facebook’ button on the jsp page
When I click on the ‘facebook’ button, its opening a new window and connecting to facebook, but I am seeing below error consistently
{
"error": {
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
"type": "OAuthException",
"code": 191
}
}
My environment information given below:
Using JBoss App Server
I have a host name like local.test.me [updated my host file]
I accessed the page like http://local.test.me:8080/test.html
did i miss something??
Gigya has documentation about this:
http://developers.gigya.com/display/GD/Facebook
And other posts in SO here:
Facebook login "given URL not allowed by application configuration"