我打算为每个用户编写一个超过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 "";
}
}
答案 0 :(得分:1)
谁是此用户?
如果您要求您的用户登录他们的Instagram帐户并授权您的应用,那么您每个用户每小时可以发出5000个请求:
http://instagram.com/developer/limits/
如果您只使用密钥,则无论您拥有多少用户,每小时限制为5000次。