(#371) Some subcategories don't represent a place - facebook

I'm getting this error when sending some place_topics on an update request to the Facebook Graph API for a given Facebook Location Page.
{"error"=>{"message"=>"(#371) Some subcategories don't represent a place.", "type"=>"OAuthException", "code"=>371, "error_subcode"=>1721087, "fbtrace_id"=>"CIewiBZL+jf"}}
It is fixed by changing the category_id for another one. BTW, I would like to know if is there a way of knowing which categories are allowed and which ones doesn't. It would be nice to know it in advance to disallow some of the Facebook Categories in the editing process of our tool and avoid errors.
Thanks,
David.

Use search?type=placetopic&topic_filter=all in graph explorer to get list of valid place topics

Related

How to get responses and comment attachments with Graph API

I am working on capturing Facebook page, event and group feeds with the Graph API. It's for a research project for my master studies. With these lines in the Graph API Explorer
{page-id}/feed?fields=from,message,likes,comments,attachments
I can capture the most I need. But the responses on comments and the attachments in comments (like when someone uses images in his or her comment) are still missing. How can I get them with the Graph API Explorer? It would be greet if I can get them within the whole context of the feed, not just when typing in the specific comment-id in the Graph API Explorer. Is there any way to get the needed data?
As https://developers.facebook.com/docs/graph-api/reference/v2.7/object/comments#read explains, it depends on the filter modifier whether you only get the top-level comments (toplevel, default), or all comments including replies (stream)
So if you modify your request as follows, you will get comments and replies on them in one go:
{page-id}/feed?fields=from,message,likes,comments.filter(stream),attachments
^^^^^^^^^^^^^^^
But that will give you all comments on the same level in the data structure, so you won’t know which are replies – so you might want to request the parent property as well; for replies that holds the id of the parent comment. With
comments.filter(stream){parent,from,message,created_time}
you will also get the parent for comments that have one. (Once you’re asking for a specific field, you need to ask for the rest of the fields you want as well.)

Facebook API Multiple Search Type

Hi and thanks in advance.
I am currently working with the Facebook API, and I want to incorporate the search feature in my system, but the only problem is that I would like to do a search with one or more keywords for one or more type of object.
In other words not only search for posts but also, I would like to be able to search for posts, users and probably even events.
I have tried to put the parameter type like following type='post,user' but it doesn't return anything, the result is empty.
Is there a way to do it? The Facebook API manual doesn't say much about the search.

How to find Facebook group id by name

I have a Facebook application, which I would like to be able to read facebook group feeds.
I have a user-input feed url, that looks like this: http://www.facebook.com/groups/music.sharing/
To access the feed though, I can only use its id, like this: http://graph.facebook.com/[id of group]/feed
I cannot find anything for that in the reference, FQL doesn't allow querying by name so .. I'm stuck. Any ideas ?
Thanks!
Its not possible right now, there are multiple open "bugs" and another stating the issue...
All the ways I have tried have failed... e.g. (below would work for pages)
fql?q=select id from profile where username='music.sharing'
We are facing this same problem on our current project. It is not an elegant solution that uses the API, but for now we will be using a workaround by scraping the HTML of the group landing page. The group ID number appears four times on this page in the html via links. The most reliable way to search for the ID is to search for "cid=" as it only appears once (right now, anyway) on the page (what follows cid= is the numerical ID). You'll see what I mean when you examine the html of a group page.
If you found a more efficient solution, I'd be grateful if you shared :)
A possible alternative until bug resolution could be: if you are asking your users for permissions then you can ask for the additional permission, user_groups, and then query graph api http://graph.facebook.com/[id of user]/groups. The returned data has group name, id, version, bookmark_order.

Facebook Graph API SEO Comments and Profanity Filter

I'm trying to integrate the Facebook comments left on our site in a way in which the content can be crawled by search engines and also for people (although I highly doubt there will be many) who don't have Javascript enabled on their browser.
Currently our Facebook comments are displayed via the use of the Facebook comment social plugin (using the <fb:comments href="MY_URL" num_posts="50" width="665"></fb:comments> tag). This ends up rendering an iFrame (which are mostly ignored by search engine crawlers) so the plan is to render this information and format it with basic HTML. To do this, the comments are pulled using the Graph API - this is then only be displayed to crawlers and people with Javascript disabled.
This all works nicely using the Graph API call (https://graph.facebook.com/comments/?ids=MY_URL), parsing the JSON result and displaying it on the page. The problem is that the <fb:comments> approach filters our results based on a blacklist we have set up on one of our Facebook Apps. The AppId with the relevant blacklist is stored on the page using metadata (<meta property="fb:app_id" content="APP_ID"/>) which the <fb:comments> control obviously must somehow use to filter the comments.
The problem is the Graph API method does not filter any results as I guess no blacklist (or App Id containing a blacklist) is specified. Does anyone know how to specify a Facebook App ID to the API call URL or of another way to not fetch commnents back that violate the terms of the blacklist?
On a side note, I know the debate about filtering content in comments rages on but it is a management decision to implement the blacklist, and one that I have no influence in changing - just incase anyone felt the need to explain the reasons why content filtering is or isn't a good idea!
Any thoughts on a solution?
Unfortunately there's no way to access a filtered list of comments using the API - it might be a reasonably request to have this in the API - you should file a wishlist item in Facebook's bug tracker
Otherwise, the only solution I can think of is to implement your own filter on your side when retrieving and displaying the comments from the API.
According to the Comments plugin documentation the filter on Facebook's side is implemented as a simple substring match, so it should be trivial to implement.
A fairly simple regular expression match should be able to check each comment against a relatively long list quickly.
(Unfortunately, the tradeoff here is that implementing a filter is easy, but you'd also need to write an interface so that whoever's updating the list of disallowed words can maintain the list for both the Facebook plugin, and your own filtering.)
Quote from docs:
The comment is checked via substring matching. This means if you blacklist the
word 'at', if the comment contains the sequence 'a' 't' anywhere it will be
marked with limited visibility; e.g. if the comment contained the words 'bat',
'hat', 'attend', etc it would be caught.
Pretty sure there is no current way of doing this from the graph API, the only thing I can suggest is taking the blacklist and build your own filter

Facebook Graph API: Getting the total number of posts

I've been using the Facebook Graph API to display user posts. When I get the initial "page" of posts, the resulting data object has a paging property object with a previous and next URL property. I was hoping to generate navigation links based on this available paging information. However, sometimes these URLs point to an empty set of data, so I obviously don't want to navigate the user to an empty page.
Is there a way to find the total count of objects in a collection so that better navigation can be derived? Is there any way to get smarter paging data?
Update:
Sorry if my post isn't clear. To illustrate, look at the data at https://graph.facebook.com/7901103/posts and its paging property URLs. Then follow those URLs to see the issue: empty pages of data.
Since it pages the datas with date-time base. You can't get the knowledge of whether if there are datas or not before you actually send the request to it. But you can preload the data from previous url to determine is it suitable to dispaly a previous link in your web page.
Why be dependent of Facebook?
Why don't you preload all data for a user and save into a database. Then you fetch the posts from db and show to user. This way you have all the control on how many posts there are and how to manage next and prev.
I was going to try to post this as a comment to your question, but I can't seem to do so...
I know that the Graph API returns JSON, and while I've never come across a way to have the total number of posts returned, depending on what technology you are using to process the response, you might be able to capture the size of the JSON array containing the posts.
For example, if I were using a java application I could use the libraries available at json.org (or Google GSON, or XStream with the JSON driver) to populate an object and then simply use the JSONArray.length() method to check for the number of posts returned.
see:
http://www.json.org/javadoc/org/json/JSONArray.html
It might seem like a bit of a simplistic solution, but might be the type of work around you require if you can't find a way to have Facebook return that data.
Can you specify what technology your application is based in?