我要编写一个应用程序,每个用户都有超过 50 个请求。我应该为每个经过身份验证的用户获取访问 token 吗? 以及如何使用 java 做到这一点?我使用 API 获取但如何获取访问 token ?
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 "";
}
}
最佳答案
谁是这个的用户?
如果您要求用户登录他们的 Instagram 帐户并授权您的应用,那么每个用户每小时可以发出 5000 个请求:
http://instagram.com/developer/limits/
如果您仅使用 key ,则无论您有多少用户,每小时的请求数不得超过 5000 个。
关于java - 我应该为每个 Instagram 用户获取一个新的访问 token 吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27561917/