我应该为每个用户Instagram获得一个新的访问令牌

时间:2014-12-19 08:03:28

标签: java android instagram

我打算为每个用户编写一个超过50个请求的应用程序。我应该为每个经过身份验证的用户获取访问令牌吗? 以及如何使用java?我得到了API,但如何获取访问令牌?

class GetRequestAsyncTask extends AsyncTask<String, String, String> {
        @Override
        protected String doInBackground(String... uri) {
            DefaultHttpClient http_client = new DefaultHttpClient();
            HttpResponse response;
            String respondString;
            try {
                response = http_client.execute(new HttpGet(uri[0]));
                StatusLine statusLine = response.getStatusLine();
                if (statusLine.getStatusCode() == HttpStatus.SC_OK) {
                    ByteArrayOutputStream out = new ByteArrayOutputStream();
                    response.getEntity().writeTo(out);
                    respondString = out.toString();

                    out.close();
                    Log.w("FLAG!", "Data downloaded:"+respondString);
                    return respondString;
                } else {
                    response.getEntity().getContent().close();
                    throw new IOException(statusLine.getReasonPhrase());
                }
            } catch (ClientProtocolException e) {
                Log.e("ClientProtocolException GetTask", e.toString());
                return "";
            } catch (IOException e) {
                Log.e("IOException GetTask", e.toString());
                return "";
            }
        } 

1 个答案:

答案 0 :(得分:1)

谁是此用户?

如果您要求您的用户登录他们的Instagram帐户并授权您的应用,那么您每个用户每小时可以发出5000个请求:

http://instagram.com/developer/limits/

如果您只使用密钥,则无论您拥有多少用户,每小时限制为5000次。