Making an autocomplete field for locations using Facebook Places - facebook-graph-api

I'm looking to make something similar to the location autocomplete in Facebook's "Create Event" page. It gives location name, address, and number of check-ins. Do you know how is it done? Because the Places table does not have any field for address and nubmer of checkins.
https://developers.facebook.com/docs/reference/fql/place/
I was going to use Factual, but after some trial and error, found out that facebook is more comprehensive.

Try this query. It ensures that the checkins field is also returned as part of the search request.
https://graph.facebook.com/search?q=coffee&type=place&center=37.76,-122.427&distance=1000&fields=location,name,id,checkins

There is a graph place search API.
https://graph.facebook.com/search?q=coffee&type=place

Related

Hybris ProductListPage does not find category

here is my question. I have one ProductListPage where I want to display a single product. I have a simple Product catalog with one category "TestCategory" and one product assigned to it "TestProduct". What I want is just to display the product in my Product List Page.
However, when I access the Product List Page, there is a message stating:
Category with code 'TestCategory' not found! (Active session catalogversions: ProductTestCatalog.staged, ContentTestCatalog.staged)
Both content and product catalogs are synched and everythings seems fine. I started an indexer operation wizard and it was successful, but nothing has changed, I keep getting this message, even though the category is existing - it even comes with the name "TestCategory not found" What should I do to find it?Can you provide any ideas or solution to this problem? Maybe the problem is in my Solr Configuraiton? If yes, any ideas how to fix it will be highly appreciated. Thanks! :))
The ProductDetails Page in the hybris Accelerator does not use SOLR so it is unlikely to be that.
The error suggests that the category TestCategory is not visible to the current user in the current session.
The Active Session catalogVersions should show Online catalogs only unless you are in Preview/LiveEdit. So this suggests something is wrong.
You should try to understand the SearchRestrictions in the Session.

Facebook Graph Pagination loses query on future pages

Let's say I want to search for McDonalds in a certain location using Facebook's graph API, like so. Now, since I know that Facebook won't always give me back all the results I want on the first page, or even the number of results I asked for, I follow the pagination link. This is the one I was given. Now, this second page loses the query string, and returns a bunch of results near the search location, but having nothing at all to do with McDonalds (e.g. Tufenkian Artisan Carpets Chicago). How can I tell when I have no more applicable results, if the pagination drops my original query entirely?
It looks like removing the limit parameter causes pagination to correctly have the query on future pages: see the same search without the limit parameter.

Does anyone else get empty search results when using Facebook Graph API Public Search?

Could someone do me a flavour and let me know if you also get back an empty json array when you click on the sample user search url on the Facebook Graph Api docs page.
Here is the page http://developers.facebook.com/docs/reference/api/
It is in the search section. the people link.
Here is the link I am clicking and all other search links return data except the user search.
This is what I get back
My question is do other people have this problem as well or is it just me.
My suspicion is that it has to do with the way Facebook filters by privacy after they've selected your results. Meaning graph asks for (X) results, Facebook finds (X) results that match your search, then removes those who have it in their privacy options not me be searched, and then after filtering returns what's left. This is explained on Facebook's dev blog: https://developers.facebook.com/blog/post/478/
See the following answer for clearer details: https://stackoverflow.com/a/11848002/624590
That said, it could be something else - I've noticed it's been getting especially bad in recent weeks; fewer and fewer results seem to be returned.
We've been getting empty results for type=post for periods of 1-2 hours for the past few days. I'm sure it's related to something on their end, check out my bug post here http://developers.facebook.com/bugs/456910301017301?browse=search_509b0461dc68c0151458645

Finding out if an Open Graph Object has been liked before

Is there anyway to determine if an object in Open Graph has been liked?
The documentation seem to imply that I have to post a like action on my object and expect an Error 3501 when it has been liked before.
From an UI pov this doesn't make sense, I want to change my like button ui to an "unlike" state without having to like my object and see if it fails or not.
Thanks!
If you're looking specifically for likes on an Open Graph Object (as in the target of an Open Graph Action), and you're talking about built-in (og.likes) likes, Shawn's answer is mostly right, but you need to look in a different FQL table.
An Open Graph Object is just a URL that resolves to a page that has og:type meta in its header. Facebook treats these as link objects (you can check this with SELECT type FROM object_url where url='http://url.to/your/object')
You can find interesting information in the link and link_stat FQL tables, but what you're looking for is the join table where Facebook relates user likes to links: the url_likes table.
So, to tell if the current user has liked a given Open Graph Object, you'd use:
SELECT user_id FROM url_like WHERE user_id=me() AND url='http://url.to/your/object'
If you get a value back, the current user has already liked it. If you get an empty array, the current user has not liked it.
To my knowledge, there's no way to do this with the Graph API, only FQL. I'd love to be proven wrong, though.
Depending on the object, if the object has a like connection you can user the graph api to determain if current user has liked the object.
i use fql in a similar fasion to check if a user likes a post.
/fql?q=SELECT+user_id+FROM+like+WHERE+post_id=\''.$postid.'\'+AND+user_id=me()
refer to post / like https://developers.facebook.com/docs/reference/api/page/

How to get external URLs likes

I'm trying to get the list of all the pages that a user "likes", both Facebook pages and external pages.
I know that the facebook pages (such as http://www.facebook.com/DealExtremeFans) I can obtain them with the "me/likes" value from the Graph.
But for a page such as (http://mashable.com/2012/01/20/advertisers-this-is-what-an-nfl-fan-looks-like-infographic/) that has a like button (under the title) I don't see how to get those likes.
Is this possible? If not, are you planning on adding support for this any time soon?
Thanks
EDIT:
According to the response below, even though they are added via the "like" button they are really "Shares".
Now my question is, how do I get those shares? what's the graph for them? I tried "me/shares" but doesn't exist.
Is there a way?
Yes it is possible, but it looks like that URL only has shares:
Click here.
And here is a link to a tutorial for getting the data via jQuery.