Post 使用 c# 在 Instagram 上使用 API 图片

Post Image on Instagram with API using c#

我正在构建一个 Asp.net C# 应用程序,我想 post 用户将图片直接上传到 Instagram,但快速搜索后我在 API 中找不到任何功能有人帮助我如何通过 C# 代码 post 在 Instagram 墙上显示图像

下面的代码我可以获得访问令牌

    private void Authentication()
      {      
                string rest = string.Empty;
                GlobusInstagramLib.Authentication.ConfigurationIns config = new GlobusInstagramLib.Authentication.ConfigurationIns("https://instagram.com/oauth/authorize/", ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"], "https://api.instagram.com/oauth/access_token", "https://api.instagram.com/v1/", "");
                oAuthInstagram _api = oAuthInstagram.GetInstance(config);
                rest = _api.AuthGetUrl("likes+comments+basic+relationships");
                Response.Redirect(rest); 
       }

//回调Url

 public ActionResult Instagram()
    {
        string code = (String)Request.QueryString["code"];
        oAuthInstagram objInsta = new oAuthInstagram();
        GlobusInstagramLib.Authentication.ConfigurationIns configi = new GlobusInstagramLib.Authentication.ConfigurationIns("https://api.instagram.com/oauth/authorize/", ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"], "http://api.instagram.com/oauth/access_token", "https://api.instagram.com/v1/", "");
        oAuthInstagram _api = new oAuthInstagram();
        _api = oAuthInstagram.GetInstance(configi);
        AccessToken access = new AccessToken();
        access = _api.AuthGetAccessToken(code);
        string accessToken = access.access_token;
        string id =access.user.id;
        ViewBag.accessToken = accessToken;`enter code here`
        ViewBag.Uid = id;
        return View();     
    }

下面的代码我得到了访问令牌和配置文件 ID 如何 Post 图片 ?一些身材高大的我

您不能通过 API 将照片上传到 Instagram。来自 Instagram 的 API 文档 https://instagram.com/developer/endpoints/media/:

At this time, uploading via the API is not possible. We made a conscious choice not to add this for the following reasons:

  • Instagram is about your life on the go – we hope to encourage photos from within the app.
  • We want to fight spam & low quality photos. Once we allow uploading from other sources, it's harder to control what comes into the Instagram ecosystem. All this being said, we're working on ways to ensure users have a consistent and high-quality experience on our platform.