Instagram远程服务器返回错误:(429)UNKNOWN STATUS CODE

时间:2015-10-30 12:26:13

标签: c# instagram instagram-api http-status-code-429

我正在使用自己的instagram api处理一些新程序。 除了用户脚本以外,一切都和我一起工作正常 我想按照我的用户ID列表 所以我使用这段代码

        foreach (var item in listBox1.Items)
        {
            WebRequest request = WebRequest.Create("https://api.instagram.com/v1/users/"+item+"/relationship?access_token=" + Common.token2);
            request.Proxy = null;
            request.Method = "POST";
            string postData = "action=follow";
            byte[] byteArray = Encoding.UTF8.GetBytes(postData);
            // Set the ContentType property of the WebRequest.
            request.ContentType = "application/x-www-form-urlencoded";
            // Set the ContentLength property of the WebRequest.
            request.ContentLength = byteArray.Length;
            // Get the request stream.
            Stream dataStream = request.GetRequestStream();
            dataStream.Write(byteArray, 0, byteArray.Length);
            dataStream.Close();
            WebResponse response = request.GetResponse();
            // Display the status.
            MessageBox.Show(((HttpWebResponse)response).StatusDescription);
            dataStream.Close();
            response.Close();
            new System.Threading.Thread(GetInfo).Start();
            Thread.Sleep(TimeSpan.FromSeconds(2));
        }
        listBox1.Items.Clear();

它先成功跟随5,然后返回

  

远程服务器返回错误:(429)UNKNOWN STATUS CODE。

1 个答案:

答案 0 :(得分:0)

The follow API call only allows 20 API calls/hour. After this limit, you will get 429 error

If you implement signed calls then you can do 60 calls/hour.

Here are details of the limits. https://instagram.com/developer/limits/