Skip to content

jarveycooper/InstaAPI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

InstaAPI

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.

Quick Note

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
Yuvraj Singh Babrah, 2015 # Requirements
  • DotNet Framework 4 or above
  • Newtonsoft json library
# Quick Walkthrough Refer the following quick-guide for using the API - Creating InstaConfig Object (to be used for both authenticated and unauthenticated requests) ``` List scopes = new List() { Scope.basic, Scope.relationships, Scope.likes }; InstaConfig config = new InstaConfig("CLIENT_ID", "CLIENT_SECRET", "REDIRECT_URI", scopes);

// 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!

About

C# wrapper for Instagram API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%