public string InstagramSingleUser(string UserId) { string response = string.Empty; try { GlobusInstagramLib.Authentication.ConfigurationIns configi = new GlobusInstagramLib.Authentication.ConfigurationIns("https://api.instagram.com/oauth/authorize/", "f5f052ccbdf94df490020f852863141b", "6c8ac0efa42c4c918bf33835fc98a793", "http://localhost:9821/InstagramManager/Instagram", "http://api.instagram.com/oauth/access_token", "https://api.instagram.com/v1/", ""); oAuthInstagram _api = new oAuthInstagram(); _api = oAuthInstagram.GetInstance(configi); AccessToken access = new AccessToken(); //ArrayList arrList = instagramRepo.getAllInstagramAccounts(); //Domain.Socioboard.Domain.InstagramAccount instaacc = (Domain.Socioboard.Domain.InstagramAccount)arrList[1]; //string tk = instaacc.AccessToken; string tk = "422418207.d89b5cf.7d26304ef400404d816218f2318f6cc6"; response = _api.WebRequest(oAuthInstagram.Method.GET, "https://api.instagram.com/v1/users/" + UserId + "/?access_token=" + tk, null); } catch (Exception ex) { } return response; }
public string InstagramSearch(string keyword, string WebUrl) { string response = string.Empty; string resId = string.Empty; try { GlobusInstagramLib.Authentication.ConfigurationIns configi = new GlobusInstagramLib.Authentication.ConfigurationIns("https://api.instagram.com/oauth/authorize/", "f5f052ccbdf94df490020f852863141b", "6c8ac0efa42c4c918bf33835fc98a793", "http://localhost:9821/InstagramManager/Instagram", "http://api.instagram.com/oauth/access_token", "https://api.instagram.com/v1/", ""); oAuthInstagram _api = new oAuthInstagram(); _api = oAuthInstagram.GetInstance(configi); AccessToken access = new AccessToken(); //ArrayList arrList = instagramRepo.getAllInstagramAccounts(); //Domain.Socioboard.Domain.InstagramAccount instaacc = (Domain.Socioboard.Domain.InstagramAccount)arrList[0]; //string tk = instaacc.AccessToken; string tk = "422418207.d89b5cf.7d26304ef400404d816218f2318f6cc6"; //TODO : Access token Logic response = _api.WebRequest(oAuthInstagram.Method.GET, "https://api.instagram.com/v1/users/search?q=" + keyword + "&access_token=" + tk, null); if (!response.StartsWith("[")) response = "[" + response + "]"; JArray Instagramaccarray = JArray.Parse(response); foreach (var acc in Instagramaccarray) { var data = acc["data"]; foreach (var page in data) { try { if (page["website"].ToString().Equals(WebUrl)) { resId = page["id"].ToString(); break; } } catch (Exception e) { } } } } catch (Exception ex) { } if (string.IsNullOrEmpty(resId)) { return string.Empty; } return InstagramSingleUser(resId); }