Is there ANY way to remove photo tags with facebook API? - facebook

There are some old posts related to this topic but the API has since changed, so I wanted to ask again. Is there any way to remove photo tags with the Facebook API?
I saw this documentation about deleting photo tags with the graph API.
https://developers.facebook.com/docs/reference/api/photo/#tags
You can delete a tag for a particular user in the photo by issuing a HTTP DELETE request to /PHOTO_ID/tags/USER_ID or PHOTO_ID/tags?to=USER_ID.
Deleting a tag on a photo requires the publish_stream permission and supports the following parameters.
Parameter Description Type Required
to USER_ID of the User to tag; can also be string yes
provided in URL path (see above).
If the deletion is successful, you get the following return.
Description Type
If the deletion succeeded boolean
It did not work when I tried it. Instead, I always get the following error:
{
"error": {
"message": "(#3) Application does not have the capability to make this API call.",
"type": "OAuthException",
"code": 3
}
}
I submitted a bug report to Facebook and they seemed to acknowledge a bug by putting it into "triaged" status. Then a few weeks later, although several other developers had subscribed to the bug report, they closed the case with this explanation:
We are prioritizing bugs based on impact to the developer community. As this bug report has not received much attention from other developers, we are closing it so as to better focus on the top issues. There is a good chance your issue is due to an implementation problem in which case you can try to find help on Stack Overflow.
The bug report is here: https://developers.facebook.com/bugs/122135101317762
Can anyone help me figure out how to untag via the API? My app is currently written as a Web app, not as a mobile one.
Thank you in advance for any help on this.

Update: As Christopher Blizzard explains in the accepted answer, this isn't in fact a bug, but intentional behaviour that was previously badly documented.
Before this was known, back when this answer was first posted, I investigated a little to try and figure out if there was any way around this restriction. The answer is no. I've left the detail of my findings below in case they are of interest to anybody in the future, but Christopher Blizzard's input makes most of this obsolete.
I'm reasonably confident that the answer is no, there's no way at all. I've exhausted all possible lines of investigation I can think of, and come up blank. Let me list my findings:
1) The bug affects both ways of deleting photo tags listed in the documentation.
Sending a delete request to https://graph.facebook.com/PHOTO_ID/tags/USER_ID/ and sending one to https://graph.facebook.com/PHOTO_ID/tags?to=USER_ID should both work, according to the documentation. However, in reality, both approaches fail with the following error, as you've already observed:
{
"error": {
"message": "(#3) Application does not have the capability to make this API call.",
"type": "OAuthException",
"code": 3
}
}
2) It's got nothing to do with your app's permissions
Using Graph Explorer you can easily test this stuff out using an access token that grants you all possible permissions, and deleting tags still fails.
3) It's got nothing to do with the user's privacy settings
I tried creating a new user on Facebook and setting every single privacy setting in the settings menu to the most lenient option available. It made no difference.
4) It's not to do with the photo's owner or how the original tag was created
Even when the person whose access token you're using owns the photo that the tag is on and created the tag themselves, you still get the same error when trying to delete the tag. This applies whether they created the photo and tag through the normal Facebook user interface, or with your app through the Graph API.
5) There's no workaround using APIs other than Graph
FQL only allows data retrieval, not insertion, modification or deletion. Open Graph has no methods relating to photos or photo tags. The deprecated REST API - which is still functional, but which Facebook instructs us not to use, and whose documentation has been taken down - has functioning methods for getting and adding tags, but none for deleting them, as you can see in a a cached version of the documentation, via the Wayback Machine.
6) There doesn't seem to be any way to delete a tag using POST requests.
You can change the location of an existing tag, but that's it. Specifying an invalid location throws an error and doesn't affect the existing tag. Specifying the to field twice in a post request to try and change the target of a tag throws an error and has no effect.
7) Others have tried to solve the same problem before, and they have not succeeded.
I haven't found many posts about this issue, but there are these two, neither of which are helpful:
Delete photo tag from Graph API
http://queforum.com/facebook-applications/78655-facebook-untag-user-photo-via-facebook-graph-api.html
After testing all the points above, I'm out of ideas. Of course, there's no way I can say with certainty that this is impossible - we don't know what's going on on Facebook's back end or why the bug exists. I think these tests represent a pretty thorough examination of the problem, though, and they haven't revealed any solution.

I just updated the documentation on developers.facebook.com, but the short version is that the delete tag API is whitelisted only for certain apps.

Related

ColdFusion - OAuthException - This authorization code has expired. [code=100]

I am having a go at trying to get the Facebook API SDK for ColdFusion working.
https://github.com/affinitiz/facebook-cf-sdk
I have followed all the steps and it seems to work well (using only server-side login).
However, if I leave the page for say, an hour, when I return and refresh the page (which was showing my profile name and friends list) it shows up with an error that I am unable to get rid of, unless I clear the cookies.
Is there something I am missing with this FB login? Am I meant to be checking against something manually in order to persist the session?
Looking at my cookies, I have the following stored:
fbm_155030275875
fbsr_155030275875
CFID
CFTOKEN
It's all new to me, so I'm a bit lost. I can't see anything in the docs for the SDK about this and Googling the error brings nothing.
I have attached a screenshot of the error.
I'd appreciate any help you can offer!
Thanks,
Michael.
I'm not familiar enough with that particular project, but in general, your code should be requesting the various Graph API calls, and requesting the token as necessary. If the token has expired, you request a new one. I'd expect the facebook-cf-sdk product to do this, but again, I'm unfamiliar with it.
Good news is, the Facebook Graph API is just a series of HTTP calls. See my talk at NC DevCon for an example of logging in and making some graph calls: (a bit long; go to about the 1:42:00 mark)
http://textiles.online.ncsu.edu/online/Play/61d0900d63fd4c1cb862622d1c8e13521d?catalog=35211b84-031b-4a18-8875-506f09b9b3a7
GitHub repo:
https://github.com/bdcravens/ncdevcon2012-handson-auth (note the branches - check out the step4 branch)
These don't answer your question 100%, but they may be a good starting point for you.
Ok, I figured out how to solve this issue using a solution someone provided on Github. I just wanted to post this here in case someone else encountered the issue and wasn't sure how to solve it. In my case however, after I applied the solution from that post was I need to do a page refresh. Link below.
https://github.com/affinitiz/facebook-cf-sdk/issues/31

Video Tags No Longer Available Via YouTube API?

About a month ago YouTube decided to get rid of it's "tags" from the frontend of their website:
http://youtubecreator.blogspot.com/2012/08/tags-removed-from-video-watch-pages.html
Which also in turn left media:keywords blank through any API feed request as read here:
http://apiblog.youtube.com/2012/08/video-tags-just-for-uploaders.html
The nice thing was for another month or so (until a few days ago) you could still access a video's "tags" or "keywords" through the API by looping through the category term(s)
It seems YouTube has taken that away also and it now only displays ONE category term for each API feed...and most of the time they are the basic YouTube categories like "Music" or "People" etc.
My questions to the YouTube development team is why was this taken away from the API (I understand taking it away from the frontend of the website) and will it ever return in any form to the API?
In the original Creators blog post you guys stated:
"Tags remain an important way to organize and help others find your videos. We strongly encourage you to continue tagging videos -- this will help increase your audience by improving the discoverability of your content."
So if Tags are still important and still utilized for search results...why in the world are they not available through the API anymore?
Any help and/or info would be greatly appreciated as this has completely destroyed the functionality of MANY of my sites! Thank you.
It appears they've made them private and you must use an authorized API request with adequate channel privileges to access them now. This really sucks since I've used them for filtering videos from a channel on a site and making authorized connections to the API via PHP has been complicated for me to get working correctly.
And the fact that this added complication is ONLY for keywords seems a bit ridiculous, but I don't guess the Youtube API team cares.
Unless a WHOLE lot of people complain about it, I doubt they'll add this back as a public.
I just added
Update: This change also applies to <category
scheme="http://gdata.youtube.com/schemas/2007/keywords.cat"> tags,
which were not mentioned in the original announcement.
to the announcement blog post. <category> tags should have been removed for the same reason <media:keywords> was removed, but due to an oversight they were left in unauthenticated API responses for a few weeks. There are no plans to add back keyword information via either metadata field.
If your goal is to have some semantics in the video, Freebase Topics can help. You can for instance do a JSONp call
<script src="https://www.googleapis.com/freebase/v1/topic${item}?filter=/type/object/name&callback=putFBname"></script>
with a small javascript function
<script>
function putFBname(respuesta){
span=document.getElementById(respuesta["id"]);
span.innerHTML=" "+respuesta["property"]["/type/object/name"]["values"][0]["text"];
}
</script>
to get the name of the topic.
Freebase topics come in the API v3.

Crazy Facebook UI Dialog Error

So I cannot find any reason I am seeing the below behavior and if anybody has some insight it will be greatly appreciated.
Basically I am using the FB.UI from the JavaScript SDK to send a message to a user with a link. The link ends with a Guid, like http://www.domainname.com/register/33a1a0ae-e0fe-4eb6-9bf9-146d5492e3d6. This works sometimes, but occasionally fails with a generic 500 error from FB.
I have pulled out the HTTP POST request and have found a solution that I can recreate, unfortunately I cannot share the access code to allow SO users to actually run it (I replaced all sensitive parameters). Below are two identical requests that differ only in the Guid. The first succeeds every time and the second fails every time. I have numerous Guids that are doing this which makes if unreliable.
https://www.facebook.com/dialog/send?access_token=XXX&api_key=XXX&app_id=XXX&channel=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D5%23cb%3Df2cb8f5c1ca0402%26origin%3Dhttp%253A%252F%252Fwww.domainname.com%252Ff350c0fd55d5764%26domain%3Dwww.domainname.com%26relation%3Dparent.parent&channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D5%23cb%3Df11a615f3b71192%26origin%3Dhttp%253A%252F%252Fwww.domainname.com%252Ff350c0fd55d5764%26domain%3Dwww.domainname.com%26relation%3Dparent.parent&description=test&display=iframe&link=http%3A%2F%2Fwww.domainname.com%2Fregister%2F**33a1a0ae-e0fe-4eb6-9bf9-146d5492e3d6**&locale=en_US&name=test&next=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D5%23cb%3Df22e359d88321ce%26origin%3Dhttp%253A%252F%252Fwww.domainname.com%252Ff350c0fd55d5764%26domain%3Dwww.domainname.com%26relation%3Dparent%26frame%3Df33c13cd4ecc156%26result%3D%2522xxRESULTTOKENxx%2522&picture=http%3A%2F%2Fwww.domainname.com%2Fimg.gif&sdk=joey&to=XXX
https://www.facebook.com/dialog/send?access_token=XXX&api_key=XXX&app_id=XXX&channel=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D5%23cb%3Df2cb8f5c1ca0402%26origin%3Dhttp%253A%252F%252Fwww.domainname.com%252Ff350c0fd55d5764%26domain%3Dwww.domainname.com%26relation%3Dparent.parent&channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D5%23cb%3Df11a615f3b71192%26origin%3Dhttp%253A%252F%252Fwww.domainname.com%252Ff350c0fd55d5764%26domain%3Dwww.domainname.com%26relation%3Dparent.parent&description=test&display=iframe&link=http%3A%2F%2Fwww.domainname.com%2FFregister%2F**dd171262-dbcc-43c3-b9d1-e37dc53e3520**&locale=en_US&name=test&next=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D5%23cb%3Df22e359d88321ce%26origin%3Dhttp%253A%252F%252Fwww.domainname.com%252Ff350c0fd55d5764%26domain%3Dwww.domainname.com%26relation%3Dparent%26frame%3Df33c13cd4ecc156%26result%3D%2522xxRESULTTOKENxx%2522&picture=http%3A%2F%2Fwww.domainname.com%2Fimg.gif&sdk=joey&to=XXX
I tested both of these urls:
http://www.domainname.com/register/33a1a0ae-e0fe-4eb6-9bf9-146d5492e3d6
http://www.domainname.com/register/dd171262-dbcc-43c3-b9d1-e37dc53e3520
with the js sdk send method, and indeed the first url resulted in a 500 from facebook, while the first managed to send it.
I can't understand why the first UID triggers an error while the second does not.
The reason I kept asking for a working example of such urls is that when you share a url using facebook, they scrap that url (unless it's already in their cache) and extract meta data of that url so that a feed story can be composed.
Since the urls that I was trying are not accessible for facebook it might somehow trigger that error.
If I try this url:
http://laine.webhop.org/tresendas/register/33a1a0ae-e0fe-4eb6-9bf9-146d5492e3d6
then it works and I don't get the server error, even though it has the same UID as the first url I tried.
I suggest that you try to use urls accessible to facebook, if you still get errors for certain UIDs, then you should probably open a new bug report.

access page's notes via app token

according to fb's documentation (https://developers.facebook.com/docs/reference/api/page/) i don't need a user_access_token to retrieve the notes of a public page, an app_access_token should be enough. however, when i sent request like https://graph.facebook.com/starbucks/notes?access_token=my_app_token, i got the reply that a user access token is required.
my questions are:
did i misinterpret the documentation?
anyone else has the same problem?
anything i can do about it?
thanks!
Indeed there's something wrong in the notes connection. I honestly don't think that there's a wrong info in the documentation (but a bug in this specific connection).
I see a reported bug about this issue (reported by you?), but with a funny response from Facebook! Obviously the guy is just copy/pasting this "standard" official response and closing bugs randomly!
EVERYONE READING THIS DO THE FOLLOWING:
Create a public page (or use an existing one)
If the Notes app is not added to your page, Edit Page -> Apps -> Locate the Notes app and Edit Settings -> Add tab
Now add a test note
Go to the Graph API Explorer
Choose one of your apps and GET the page's notes to see the current note: /page_id/notes
Go the to the Access Token Tool, copy that app access_token and replace the one in the explorer with it
Result:
{
"error": {
"message": "A user access token is required to request this resource.",
"type": "OAuthException"
}
}
If this was reproducible, then subscribe to the bug and confirm by clicking on "Yes" for the reproducible question.
Access to certain Pages may be restricted based on demographic information such as the current user's age or location. Access may
also be restricted to only a Page's administrators.
Based upon your findings above, as well as this quote from the documentation link you shared above, this tells me that maybe Starbucks is only allowing their page admins access to the notes connection of their page.
Try creating a page yourself, play around with the various settings and see what is available with and without tokens. Shouldn't take you too much time.

How to access links provided on one's timeline?

I would like to have access to the links one shared on their timeline.
Using the API Graph Explorer, I see there is a way to access "links". However, it returns empty data. I believe that this might have been used when posting links in FB was done in a special way, different than posting "usual" status.
Then, I thought, I should probably get all the stream and filter the data for links. But at that point, I'm a little confused:
There are THREE different actions that seem to provide the very same data:
- https://graph.facebook.com/me/feed
- .../me/posts
- .../me/statuses
Are they actually all the same?
In addition, all seem to provide me information that is not up to date, but is true for some point in the near past. Moreover, I would like to know how I can get the relevant data from the beginning of the FB usage, or at least, for a given period of time.
Do an HTTP Get to me/links to get the most recent links the user has shared.
To limit it to a timeframe, you can do me/links?since=YYY&until=ZZZ.
Or you can use the paging object to get the previous and next url to use to get that other page of data.