Grabbing facebook stats with a c# app - c#

I have found many examples of getting data from facebook manually.
Is there a way to grab the data using an application (not a web app)?
What we are doing is creating a data repository for our customers so they can look at their data from FB, GA, twitter ect all in one place.
Facebook has me stuck as I can get an authentication code, but none of the URLs such as https://graph.facebook.com/me/friends?access_token=... will work. Guessing because "me" means I need to be logged into my site for it to work.
Any help/examples would be great.
Thank You

Related

InstaSharp authentication without user interaction

I'm trying to write a service, that can get the Instagram feed for a specific user.
Im using InstaSharp, but I can't figure out how to do the authentication without redirecting the end user to a https://api.instagram.com/oauth/authorize url
I can't find any examples, beside this (and others looking like it)
Can anyone give me any pointers.
For now I have a Instagram app in sandbox mode, and a selection of users, who have accepted the sandbox invite.
I don't think it's possible with this library. You better generate your access token by yourself - https://elfsight.com/blog/2016/05/how-to-get-instagram-access-token/ and then request user's feed as like this
https://api.instagram.com/v1/users/{USER-ID}/media/recent/?access_token={YOUR-ACCESS-TOKEN}
If you want to deserialize your JSON object to c#, please use this service - http://json2csharp.com for generating your class and then using Newtownsoft library:
JsonConvert.DeserializeObject<RootObject>(yourClass)
Good luck.

Instagram API Tag Endpoint only retrieving public photos, not private friends I am following

I am using the instagram API through the c# library, instasharp.
I have authenticated correctly (as I am able to do the self feed api call to retrieve my own private photos).
I am doing a search by a tag, however it not returning private users that I am following, which I can see in the instagram phone app.
My understanding was that the point of authenticating with the api was to see images relating to the authenticated user, including friends I am following.
If anyone could help it would be greatly appreciated.
You might want to try emailing support. I had a similar issue when trying to retrieve likes from users i am following and it was a bug in their API. Also if you could show us which endpoint you are using i could give it a try.

How to access friends album in Facebook

I am developing a Facebook application, where my application will aggregate all the photos of my friends in their albums. How will i achieve using graph api and C#?
First, look at this answer: Can I use the Facebook graph api to get user's friends profiles pictures ?
This will let you know how to generally use the graph api to get the to the friends. If you use albums instead of photo, you should get all the albums of a friend.
To get there, you will also need the friends_photos permission. I don't know if it is still up to date, but maybe you will need some more permissions.
I'm no C# developer, but these links will help you:
C# Facebook Graph API Library
Facebook C# SDK
Facebook API from C# – Getting the list of friends
Facebook recently made a nice tool you can use to explore how to get the details you need. It's called the Graph API Explorer and can be found here: https://developers.facebook.com/tools/explorer
But what is said in the other answer is correct. First you get the list of friends. Then their albums, and then the photos in the albums. Once you get the hang of the Graph API it's quite easy, but it requires a bit of tinkering to figure out at first.
If you are using C# you can use a WebRequest to get the data. Whenever you access http://graph.facebook.com/whateveryouwant it will return a string of JSON-data. This you can parse using a JSON-librabry like litJSON.
I have made an application that gets the profile photos, and it is not that hard. Just remember to get the right permissions.
The easiest way to do this is to use the Javascript API to get the loginstatus and then get some permissions. If you set cookies: true when you init the Facebook API you can get the accesss_token from the cookie. The cookie is named "fbs_YOURAPPID".
Also you need to make a developer app to get an access_token.

Is there a way to programmatically remove friends on Facebook?

It sure is a pain to prune a Facebook profile. Is there any way using the Facebook API (or some other mechanism) to authenticate as a particular user and remove friends from the user's list? I have looked through the API documentation, but I'm not familiar with the ins and outs of the platform.
I have been through the complete facebook graph api documentation on facebook while i was writing my open source .net sdk for facebook. From all that i understand, i am 99.9 % sure that this cannot be done using their api. You can create status messages, links, photos, albums, events, pages, notes etc using their api ( you need to perform simple post operations for all this ), but i have read no where that a friend can be removed using facebook api !
No API but you can program your browser or mimick a browser. Think of QtWebKit. I doubt if you need to add so many friends and just to remove them using machine.

Facebook Connect and .NET

I have an ASP.NET application and a Windows Service. My ASP.NET application allows for users to allow the application to connect with Facebook. If a user has connected the application with Facebook, the Windows Service will later (sometimes much later) post a message on the user's News Feed. I have two questions:
What information do I need to collect from Facebook?
How do I collect that information?
I know that I will need to save some information back to a database that both the ASP.NET application and the Windows Service can access. I have this approach working with Twitter. But I am trying to figure out how to do it with Facebook without much luck.
Thank you for your help.
You're basically limited to the list of "ids" in terms of data you can "save back to a database". For example, on a connect site, you cannot store their "name" or "about" for more than 24 hours:
http://wiki.developers.facebook.com/index.php/Storable_Data
To actually get the data you'll want to use one of the following API methods:
http://wiki.developers.facebook.com/index.php/Users.getInfo
http://wiki.developers.facebook.com/index.php/Users.getStandardInfo
More than likely, getInfo as getStandardInfo returns you cannot display publicly. You'll of course need to use Facebook Connect to first authenticate the user, then you can query the API using Javascript or an ASP.NET FB library to get API results. You'll find a load of client libraries here:
http://wiki.developers.facebook.com/index.php/Client_Libraries
http://wiki.developers.facebook.com/index.php/ASP.NET

Categories

Resources