How to access friends album in Facebook - c#

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.

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.

Grabbing facebook stats with a c# app

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

C# .net app to pull twitter posts?

Can a .net app be made to pull twitter posts?
I am wondering if its possible to capture any of the posts made on twitter by any user? I am trying to obtain an unrestricted flow of tweets to use as sample data for statistical analysis.
I want to try to gauge the sentiment of topics such as "thanksgiving" or "global warming"
I was thinking on a high level I would be able to pull all tweets containing a "#thanksgiving" tag and save them to a SQL DB for analysis.
Is this a valid approach of that, or is there a better way? Is there a tool to do this already that will save me the development time?
You can use the Twitter API.
Specifically, this question contains the answer you'll need to get all tweets with a certain hashtag:
Twitter API - Display all tweets with a certain hashtag?
In terms of tools to do it with, TweetSharp is a C# wrapper for the Twitter API. I can't vouch for it though as I've never used it.

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.

Categories

Resources