unlike facebook page api - facebook

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

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: Unable to reply a comment on unpublish page?

I'm using the Graph API Explorer to reply the comments on fan page via my app.
It works only the page is published. However, it bothers me so much.
How do I to test the app before publishing the page?
What I'm trying to do is the app will listen to the webhook from Facebook and then reply to the comment as long as got a comment.
I've been search for a while, there's very few questions related to this. Any suggestion would be thankful. ;)
// POST
https://graph.facebook.com/{comment-id}/comments
// response when the page is unpublished
{
"error": {
"message": "(#200) Cannot access object_id: {comment-id}",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "{fbtrace_id}"
}
}
Confirmed that you can't access the comments while unpublished as the page id prepends the comment id. I would say quickest and easiest way to test is to just create a separate test page and keep that published.

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.

Facebook Graph Api : Get info about fanpage

I'm looking for informations about this fanpage : https://www.facebook.com/gabrielmedinasurf
when I call the graph API (v1.0) at https://graph.facebook.com/gabrielmedinasurf
I get nothing but a RTFM message :
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
}
This process was supported a month ago. Does anyone had to face the same problem ?
I know the page ID : 206550296052269
but calling the API with it gave me the same result (https://graph.facebook.com/206550296052269)
Note : The v1.0 should be available until April 30, 2015 (source : https://developers.facebook.com/docs/apps/changelog)
Any help is welcome
NOTE : On this older post from SO, the process seems to work : Get Facebook fan page ID
Always use an Access Token for any Graph API call. That being said, the Page may be restricted by age or location, an App Access Token is not good enough in that case. You can only use a User Access Token or Page Access Token. I just tried with a User Token and it worked for that Page.
If you don´t know how to handle the different Access Tokens, take a look at the following links:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/

Fetching a Facebook page's events?

I am trying to fetch a Facebook page's events. I have before, but it doesnt work any more. I used this scriptto fetch the events.
$string = file_get_contents("https://graph.facebook.com/?$pageids&fields=events.limit($fblimit)&access_token=$token&method=GET");
$json_a=json_decode($string,true);
$pageids was a lot of different facebook ids (id1,id2,id2 ...)
I get this error message:
{
"error": {
"message": "(#100) Unknown fields: events.",
"type": "OAuthException",
"code": 100
}
}
Does anyone know what is wrong with my script? Is there a another way to fetch Facebook events?
The actual URL to get a page's events is something like this :
https://graph.facebook.com/PAGE_ID/events
I'm not sure how old the code is that you are fixing, but this is the correct method as stated in the documentation. events is a connection of the page object.
Reference: https://developers.facebook.com/docs/reference/api/page/#connections
Facebook has had restricted access of Events in API recently.
You have to do app review to have access to Pages API, Events API.
Please check section "Apps that Require App Review, Business Verification, and Supplemental Terms" of this url: https://developers.facebook.com/docs/apps/review