How I can Unlike Comments on the Rss Feed using Graph API.? - facebook

Hello Guys I am working on WPF app and I want to Unlike the Comments what I have been like so I am using like this.
Facebook.FacebookClient api = new FacebookClient(ExpandingNewsFeedList[0].AccessToken);
api.Delete(ID);
But it will give me error like this
.(OAuthException) (#100) Can only call this method on valid test users for your app.
so how I Can overcome this problem.?
Thank you.!!

To unlike, do an HTTP DELETE to the /objectid/likes.
Using C#, it's like this
facebookClient.Delete("/" + objectId + "/likes");

You can't delete content using an app except for some types of content which your App added (e.g. an app can delete its own posts)

Related

Can't display Facebook user avatar with Facebook API and Graph

I'm working in a React-Native app, and I'm also allowing users to login using FBSDK.
There seems to be an issue at the moment when trying to get the profile picture URL.
There are also several reports of this, like this one but still, after a year doesn't seem to be solved.
Attempted many ways but none worked, it always tries to download the file, seems it's missing the mime-type according to what the browser says.
The URL it gives is the following:
https://platform-lookaside.fbsbx.com/platform/profilepic/?asid={{myfbid}}&height=50&width=50&ext=1583348357&hash=AeTnFpMVwBXgFy_J
Also tried using the graph url directly: http://graph.facebook.com/{myid}/picture
And if I add the &redirect=false, it returns a data object with the platform-lookaside URL.
Everything I try, it tries to download.
This is how I'm currently trying to get the image using Graph API.
new GraphRequestManager().addRequest(new GraphRequest(
'/me',
{
accessToken: fbToken,
parameters: {
fields: {
string: 'picture.type(large)'
}
}
},
graphRequestCallback
)).start();
It works, but the URL is the same.
Any idea on how can I solve this? I might be missing something or the bug is still happening?
If you just change the graph url (http://graph.facebook.com/{myid}/picture) from http to https, it should work for you. Not sure if that's a new fix in React Native or not, but that solved it for me.

How can I export the feed from a group using Graph API?

I want to export the data of my Facebook group to some sort of file for historical purposes. I understand how to use the API but I don't know what I need to do to work with it. I can make queries in the explorer but it takes way to long for it to execute. I want to know what I need to do to export the data from my group into say a text file. Even just the basic steps in order to use the API would help. Thanks
You'll need to use one of the Facebook SDK's in order to programmatically access the Facebook API. Some popular ones are the JavaScript and PHP SDK's. The docs for each contain how to make API calls, and then you can use your code to handle the response to do whatever you want with them (as long as you stay within Facebook's policies).
An example of an API call in Facebook would be (after loading the SDK and having a valid login):
FB.api('/me', function(response) {
alert(response.name);
});
Let me know if that makes sense, or if you're still unclear how to approach API calls.
You have to get the feeds of the group first using graph api. Here is the code for that.
$groupFeeds = $facebook->api('/GROUP_ID/feed/?access_token='.$accessToken);
Note : $facebook is the object created of facebook class.
You have get the access token. Also you have should have the user_group permissions to extract the feeds of group.

Open Graph & Rails not retrieving object's URL

I'm using Rails to try and add an action for an object both defined for my app on the open graph. I am using an :after_filter in my controller to call the following after session#create:
#graph.put_connections('me', 'workkout:complete', :session => url_for([#plan, #session]))
I am getting the following back from Facebook:
{"error":{"type":"Exception","message":"Could not retrieve data from URL.","code":1660002}}
I have checked that the correct URL is passed to put_connections, and when I visit this URL using Facebook's Lint tool, everything is correct.
I can't understand why this isn't working, my only thought is that Facebook is hitting the URL moments before rails has generated the object? - not sure if that's even possible though.
Can anyone shed any light on this?
Turns out it was because the create action and the put_connection methods take place in independent threads and as such the URL is not ready when put_connections is called. Solution here http://railscasts.com/episodes/363-facebook-open-graph?autoplay=true

/act_{account-id}/adcreatives creative_ids parameter is not working in the Facebook Ads Graph API

I have an application that uses the Facebook Ads OLD REST API and recently I heard that it will be deprecated in a month, so I'm working hard to migrate all my code to the new Graph API...
Unfortunately, nothing goes smoothly.
when calling to GET /act_{account-id}/adcreatives to get the AdCreatives for a specific campaign the parameter creative_ids is not working and always retrieving all the creative for the account!
This was working fine in the rest api... and no documentation changes were made in ads.getCreatives so I'm assuming creative_ids paramter is still there...
Any help will be appreciated!
thanks,
Yaniv Hakim
I found the _ids parameters to be finicky so I use the generic ids=comma-separated list parameter, without the act_{account-id}. Creative IDS are unique across accounts so there's no need to specify the account-id. If you want to use the specific parameters, have you tried creative_id, creativeids, creativeid and other permutations you can think of (with and without account-id)?

iPhone facebook integration

I am using Graph API in my application. I am fetching user's facebook wall feeds using graph API also getting details of particular post i.e (Like count,Comments etc).
but i want to allow user to Like and Comment any post from the application itself.
what is the request format for that?
Please help me or give any pointers.
Regards,
Sanket
You would be well served to check out the Publishing section of the documentation. It provides information such as this.
One example is liking, which is defined as:
Method: /OBJECT_ID/likes
Description: Like the given object (if it has a /likes connection)
Arguments: none
Basically, just initiate a Graph API call to something like:
[facebookObject requestWithGraphPath:#"98423808305/likes" andDelegate:self];
That will "like" a picture from Coca-Cola (ID taken from the documentation).
Edit 1
According to the documentation:
Most write operations require extended permissions for the active user. See the authentication guide for details on how you can request extended permissions from the user during the authentication step.
Are you sure you have enough privileges? Unfortunately the documentation is very unclear as to whether it serves the dual purpose of liking the object and returning the likes already on that object.
Edit 2
I did some more research into what could be causing this and came across this question and answer that indicated that the code I posted above using requestWithGraphPath:: should work. However, it does not due to a bug on Facebook's Bug Tracker.
Unfortunately, it looks like there is no way to "like" an object via the Graph API, which seems very strange to me. Perhaps it is possible with the legacy REST API instead of the Graph API?
Edit 3
Well, it looks like your best bet is the stream.addLike method of the legacy REST API which you can still call using the Facebook iOS SDK. You should be able to use the stream.addLike method to "like" something in the "stream". Unfortunately, it doesn't appear to support photos, videos, etc. Only posts and comments.
Finally i found the solution for LIKE option
We should use following method for like option.
-(void) requestWithGraphPath:(NSString *)graphPath
andParams:(NSMutableDictionary *)params
andHttpMethod:(NSString *)httpMethod
andDelegate:(id <FBRequestDelegate>)delegate
graphPath = /OBJECT_ID/likes
Paramas = dictionary with comment ,for like option use empty dictionary
HttpMethod should be POST
you should get response = true if the LIKE request is successful.