InstaAPI is a CSharp(#) wrapper for Instagram API build in DotNET Framework 4. It is a simple, small library that uses Instagram's server-side flow for fetching access tokens.
Started working on it when I couldn't find a simple C# API for Instagram.
The API may contain some bugs; feel free to raise issues regarding the same. You can also contact me via
- email: yuvrajbabrah@live.com
- facebook: fb.com/yuvraj.babrah
- twitter: @yuvrajb
- DotNet Framework 4 or above
- Newtonsoft json library
// use this to redirect user for authenticating your application String AuthenticationUriString = config.GetAuthenticationUriString();
- <b>Creating OAuth Object</b> (to be used for authenticated requests)
OAuth oauth = new OAuth(config, "CODE_ATTACHED_WITH_REDIRECTED_URI_AFTER_SUCCESSFUL_AUTHENTICATION"); AuthUser user = oauth.GetAuhtorisedUser();
Console.WriteLine(user.AccessToken); Console.WriteLine(user.UserId); Console.WriteLine(user.UserName); Console.WriteLine(user.FullName);
- <b>Fetching User Feeds</b>
Feeds feeds = users.GetUserPosts("1118571892", new GetUserPostsParameters()); foreach (var fd in feeds.Data) { Console.WriteLine(fd.Caption.Text); Console.WriteLine(fd.Images.StandardResolution.url); Console.WriteLine(fd.User.UserName); }
- <b>Fetching Comments</b>
Comments comm = new Comments(config, user); MediaComments mc = comm.GetMediaRecentComments("662323776542578144_1118571892"); foreach (var comment in mc.Data) { Console.WriteLine(comment.From.UserName); Console.WriteLine(comment.Text); }
- <b>Posting a Commment</b>
Comments comm = new Comments(config, user); MetaData meta = comm.PostMediaComment("662323776542578144_1118571892", "i am a comment from github docs"); Console.WriteLine(meta.Code);
I'm sorry for not having a proper html type documentation. Wish Visual Studio could have some easy mechanism as provided in Netbeans. In the mean time, happy coding!