Can't delete album with Facebook graph API [duplicate] - php

I've google it and also looked some related questions here in SO, but didn't found an answer. Is there any way to delete an album from FB via Graph API call. I'm making DELETE request to https://graph.facebook.com/ALBUM_ID with corresponding access token, but it returns me the following: (#200) Application does not have the capability to make this API call.

Just as the error says - your application can not perform these actions. In actual fact - no applications can delete photo albums. It is a limitation by design of the API.
If anyone finds some evidence to prove me wrong - PLEASE dont keep it to yourself! ;)

Related

How to read facebook timeline with Graph API?

I need to read facebookk timeline and some tutorial says me to read with API Graph and I use:
https://graph.facebook.com/***/posts?access_token=***
but when I use this code I obtain {data[]} . I don' know how I wrong. Anyone can help me?
You question is pretty broad.
Did you use the Facebook API explorer? Found here
Are you sure the token is valid?
I am pretty sure what you are doing wrong is your call above is un-versioned so it will default to v2.0+. Which means you can't query based on user name. Next if you are using a user Id in the middle *** it will return empty because that user hasn't authorized the app that got the token, and/or has decided to hide themselves from open graph calls. You can use a public page ID in that spot to get that page posts.
Give this a try
https://graph.facebook.com/ME/posts?access_token=***
Provided you have a valid token it should work with unversioned calls. I suggest you play with the API explorer linked above.

Add users post to their facebook newsfeed automtically with php

I have a website I'm working on. It enables users to register and post stuffs within the site. Can I get a link to some sort of api that allows people to add their facebook account (once) and then automatically post what they posted on my site on their facebook newsfeed (the sort of thing that happens when you connect your facebook account to your twitter account) .I've searched and can't seem to get exactly what I want
What you want is pretty common and if you searched you clearly didn't do a good job on the search.
Using the Facebook PHP SDK is pretty straight forward. There is a PHP Library available with a demo of the functionality you want. In your case you need to do some stuff more, so I'll explain globally what you should do:
Get the Facebook PHP SDK and load it into your website, determine what scope you need to perform the actions what you are going to do, in your case you need to have access to their timeline which is called the publish_stream scope. In order to get the Facebook PHP SDK working you need to create an app at http://developers.facebook.com
If a user grants access you need to save the authentication token that the user provides and save it in your database for later use. I'm not 100% sure how long they are valid, I think it's maximum of 30 days at the moment, but you have the ability to refresh the toking in the requests you make (correct me if I'm wrong, it's been a while..)
Everytime an action is done using the Facebook API you inject the usertoken in the request, thus performing the "post" action onto their timeline.
What you are looking for is pretty straight forward and easy to find..

Take the likes from users of my app and file them into csv

I need to be able to consolidate all the likes from users that use my Facebook app into an Excel or .csv file. I can have the user authenticate within my Facebook app, but is there a way to see the likes for all users of an app using Open Graph or some other Facebook tool? I'm certain that someone else must have had this problem, and I'm hoping that one of you can help me out!
I've been trying to run FQL queries to bring up likes, but don't have any experience with PHP so it has been miserable so far. Any ideas?
There's no way to retrieve a list of users of your app - you'll need to manually build that as users authorise the app see this question for more information
Assuming you have permission to access a user's likes connection - access /USER_ID/likes and parse the response, saving it to a file in accordance with whatever language you're using's syntax (google is your friend here)
Note that your use of the data is subject to Facebook's policies and user's consent in accordance with your privacy policy and sharing it with third parties may be illegal (i am not a lawyer, this is not official advice, etc etc)
Here is the problem with that the application type does not have a like connection. Application Object GraphAPI This is inconvenient when you are looking to gather data on the users that like it.
OR were you talking about the likes endpoint of the user object? That you can gather but I dont think it is what you are looking for. It is shown here Graph Explorer Example - user's likes

Cannot delete application invite in Facebook after acceptance

I've looked through this site and looked at the Facebook docs but I can't seem to delete an invite after a friend accepts.
So, what happens is:
1. Steve invites John to a game.
2. John receives that invite and clicks accept.
3. John is taken to the game, but the invite message is not delete in his facebook page.
Facebook docs suggests I add "method=delete" when I post to https://graph.facebook.com/[request_id]?access_token=xxxx
But that returns me "{"error":{"type":"OAuthException","message":"(#2) Invalid parameter: Unknown error"}}". I'm pretty sure I'm using the most recent access_token.
Can anyone provide me with sample code which deletes an application invite after a user accepts?
EDIT:
I also tried DELETE i.e. DELETE https://graph.facebook.com/[request_id]?access_token=xxxx
And I get the same error
Thanks.
There's brief examples at https://developers.facebook.com/docs/reference/dialogs/requests/ and a longer example on https://developers.facebook.com/blog/post/464/ which show how to do this.
It sounds from your comments on fjsj's answer that you know what you're supposed to be doing - it definitely looks OK to me.
It could be that you're encountering a bug of some kind, but I think in this case it's more likely that somehow the access token of the user is being sent or there's a slight error in the way you're accessing the API - If there's a specific error message you're getting back? maybe post that here if there is.
Two things to check:
Is the request you're trying to delete returned when you make a GET request to /<request id>? (using the app access token)
Are the requests being sent using the newer Requests 2.0 dialogs? If you're using the older requests system, the instructions are basically the same, but the connection you access the requests at is the [currently undocumented] /<USER>/platformrequests endpoint (as opposed to /<USER>/apprequests
Try doing a HTTP DELETE instead of a POST. This is what the documentation says.

Facebook Graph API : Some requests return an ampty data array

I hope someone wil be able to help to resolve my problem.
We can't say Facebook's forums are very useful for developers...
This is my problem.
On two different applications, I execute requests with Graph API.
For one of both, I make a friends request to invite user's friends to use application.
For the second application, I use Facebook Places to retrieve all informations about a location.
These two codes are simples functionnalities tests.
Before excute a request with Graph API, I ask to user to give me necessaries authorizations.
But results are, often, an empty JSON "data" array...
Before posting here, I search some solutions on internet.
Some people say application hasn't necessaries rights. Others user must like application page to retrieve informations correctly...
I tried these solutions... whithout concluant result.
For example, talking about my Facebook Place based application.
It asks user_checkins and friends_checkins rights.
Goal is to retrieve, for a given location, datas from users who're tagged there.
But I have an empty data array as return.
I tried my code in different ways, with PHP SDK, Javscript SDK and FQL. Same result.
Thanks :)
Sorry for my english. I'm a french developper ;)
For this - "Goal is to retrieve, for a given location, datas from users who're tagged there." Refer to https://developers.facebook.com/docs/reference/api/page/ and you will see that you can only get the checkin information for the current user or friend of the current user. In the case of a friend you will only get that information if the friend has allowed other apps to see this. So to test that you get data you should check in to a place (page), find the place's id, then make a query to https://graph.facebook.com/PAGE_ID/checkins with an access token that has user_checkins permission.
Also, here is a tool that you may find useful when debugging your API calls and permissions - https://developers.facebook.com/tools/explorer

Categories