Obtaining the location of places on facebook and integrating it into window phone app - facebook-graph-api

I am trying to obtain information of a users current location I already have the users latitude and longitude what I want to know is are there any businesses (restaurants, clothing stores ect.) in that area. I was just looking at the open graph api and It says that you can search over all public objects in the social graph with https://graph.facebook.com/search. We support searchs for the following types of objects: places https://graph.facebook.com/search?q=coffee&type=place but the ones I really want to use type=location&center=37.76,-122.427&distance=1000 does not work in the API Explorer could anyone tell me what might be the problem and how do I use this in a windows phone 7 app? Links, code snippets, blog post, ebooks, Other web services that would allow me I could send lat and long and will return the location or businesses anything will be very helpfull thanks

https://graph.facebook.com/search?q=coffee&type=place&center=37.76,-122.427&distance=1000
This query should give you the results you need.

Related

How to query nearby addresses during reverse geocoding request

How do I find all the addresses in a small search radius for a specific geocode point? I want to display a user 5-10 address that he can pick from based on geolocation data I retrieve from his phone. I'm using Bing maps location API (http://msdn.microsoft.com/en-us/library/ff701710.aspx), but open to other APIs if this doesn't work. The documentation talks about BoundingBox as a supported location type but I'm unable to use when I tried.
The reverse geocoder will usually only return one location. Bounding boxes are not supported for reverse geocoding. To do what you are looking to do you will need to make multiple reverse geocoder requests over an area. I put together a code sample a few years back on how to do this using Silverlight. You should be able to see the logic in there and migrate it over to use the REST services and what ever programming language you are using.You can find the blog post here: http://rbrundritt.wordpress.com/2010/01/09/reverse-geocoding-over-a-search-area/

Facebook opengraph insights api on specific post id from my app

I want to build a dashboard that returns more customized insights from the insights generated by app.
The app is a facebook connect website that users visit and view a list of products. They can post to facebook about that particular product by sharing a custom story that incorporates that product on their timeline.
When I go to the insights for my app, it does a great job of showing me all social impressions for all custom stories that were generated on my site.
I'd like to narrow that down even more for specific products.
My plan is to record the object ids that are generated by these actions and link them to a partucular product in my database.
I'd then like to create a new dashboard page that will allow me to login, request read_insights permission from me and then use that object_id:product mapping from my database to show how many social impressions where recorded for a given product's object_ids.
Is this possible? I've read alot about it but still haven't found the most elegant way to get a segmented report of social impressions per type of content that was posted.
Thanks for your time.
The implementation all depends on which platform you want your app to run on.
The first major component is you must have a Facebook developers account which is easy to signup for. Just go to developers.facebook.com and register. Takes like 2 mins. After that you will need to create your first app and add the correct domain name where your app will be hosted and what platform it will run on. (iOS, Android, Web, ect.) Once that is finished you can make your app public so you can use the Facebook API in your code.
For the app creation itself. The first thing you need to do is import the correct API for your platform. Which you can find a walk through at https://developers.facebook.com/docs/. Once the API is imported you must build a Facebook object which contains your app id and possibly app secret. If you're using JavaScript you don't want to use the app secret because it will be visible to the public.
Now that you have your Facebook object you must require the app users to log in and grant permission to your app. You can add extended permissions to your log in process by adding a scope value to the log in button generated by Facebook. Here is an example.
<fb:login-button id="loginBtn" max_rows="1" scope="basic_info,read_insights,manage_pages" size="medium" show_faces="false" auto_logout_link="true"></fb:login-button>
After the user is logged in you can now query information from the users account using Facebook Api calls to Social Graph. Facebook also provides a tool to help you figure out what information you can query. https://developers.facebook.com/tools/explorer
Everything else you want to do with the app can be done by Facebook API calls. You just need to insure you grant the user the correct permissions before making the API calls.
API calls are a little different depending on which language syntax you are using but they all follow the same data model and return some array of responses which can be parsed using JSON or the standard array format. The Graph Explorer tool listed above will show you the output for your queries so you can handle them accordingly.
I hope this helps gets you started.
EDITED
Here's the implementation in JavaScript
function getMetric(){
// make the API call
FB.api(
"/{app-id}/insights/application_opengraph_story_impressions",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
}
Here's the reference now that Facebook docs are back up https://developers.facebook.com/docs/graph-api/reference/insights
application_opengraph_story_impressions will probably give you the total impression of all stories made by your app. I ran it against my Facebook app and it came back empty but I don't have any stories so it might work with your's. Also to note in the documentation there is an * by this metric and I could't find what that means.
I'm pretty sure that right now Facebook don't give developers ability to get insights about app custom stories.
Currently Facebook documentation has the following Graph APIs for Insights data:
/{page-id}/insights
/{app-id}/insights
/{domain-id}/insights
/{post-id}/insights (where this is a Page post)
So /{post-id}/insights won't work because custom story is actually user's post and others endpoints don't apply to your case.
As far as I know the only other option to access Insights is FQL. For that you'd use insights table in a manner similar to this:
SELECT ... FROM insights WHERE object_id = ... AND metric = ... AND end_time = ... AND period = ...
Now most likely this also won't work with your custom story posts (I don't have posts which I could try it on right now, so I can't tell) but at least it is not explicitly stated so in the documentation, so you should probably try it out.
UPDATE:
I wasn't able to get any insights data via FQL, although as far as I understand the following code should have gave me at least something (object id is for my page):
SELECT breakdown, end_time, event, metric, object_id, period, value FROM insights WHERE object_id = 224981264214413 and metric = 'page_fans' and period = period('lifetime') and end_time = 1395597892
But it results just in
{
"data": []
}
Facebook also has some pretty old bug report about similar topic: https://developers.facebook.com/x/bugs/508088155954330/ where they confirmed the issue, assigned it, and... did nothing to fix it for 6 months.
In case FQL doesn't work, my suggestion to you is - use your own analytics code to track the creation of custom stories and get the friend count of the users. It won't show you the real exposure of the posts but at least you will see some data on which types of custom stories where posted more often and what was the maximum potential friend count that could have seen them. By the way - to make charting easier, you could use Google Analytics events for that.

How to specify the country in facebook graph api search?

How to specify the country in facebook graph api search
im not very tech in this, need in simple form
https://graph.facebook.com/search?q=Sarkozy
Then, i want to have replies only in a certain country only.
https://graph.facebook.com/search?q=Sarkozy......?????
I have tried several methods, nothing worked out for being not knowledge in this
thanks in advance
Facebook uses geo ip to detect the country where the request came from, you should use a country proxy in order to "tell" facebook what kind of geo located results you want.

Where can I find the data points for the Insights chart in the Facebook dashboard?

I am currently using the Open Graph API but am not opposed to using FQL if it can get me the data points I'd like. Right now I am just hitting the urls directly and not worrying about a client SDK.
Of the three charts on http://www.facebook.com/insights/ => websites I can find the data for the Site Engagement chart in the Domain Insights in the API.
However, I can't seem to find the points for Distribution on Facebook, or Referral Traffic to Site in the insight data being returned for the domain. Did I miss them, are they available maybe in FQL or are they just not exposed yet?
Edit: It looks like someone doesn't understand what charts I am talking about so to clarify, I am looking for the following anywhere in the Open Graph API, FQL, or anyplace else in Facebook:
Like Story Impressions
Share Story Impressions
Like Story Clicks
Share Story Clicks
This info is now available via the Insights app. News Feed section has some of it, at least the story impressions and clicks.

pushing content to cell phones

I am working on a photo site and one of more active users asked about pushing content to cell phones. The site is built on django, and I was wondering if anyone knows a good way of allowing users to download and store content (images) on their cell phones?
As a side question... is it possible to accept payment for the content via the cell phone or would that have to take place on the site?
The best way to serve content to a mobile user would be to forward them to a mobile specific site. A lot of places do this by forwarding the user to http://m.mydomain.com/. You can tell if they're using a cellphone by checking against their UserAgent string as Harold said. Find more at: Change Django Templates Based on User-Agent
In terms of downloading, this is pretty phone dependant. On my iphone, for instance, I don't know that I can save images directly from the internet. (This could just be my ignorance, however). I think you're going to run into a lot of discrepencies on the browsers between different mobile devices. How many offer photo downloads vs. not, etc.
For payment, I would suggest keeping it in browser. There is SOO much that could go crazy on a cell phone and money isn't one of those places where I like to take risk. That being said, you could likely look into some sort of sms micro payment system (sorry, I don't have any recommendations) or look at partnerships with carriers such as Verison. Beyond that, I'd say keep it in the App.
Hope it helps.
Check to see if the User Agent of the phone(s) you wish to support is in request.META['HTTP_USER_AGENT']. If so, render mobile friendly templates.