【发布时间】:2015-04-05 14:32:40
【问题描述】:
我正在尝试在 android 上实现喜欢 instagram 的媒体。这是我要发布到 https://api.instagram.com/v1/media/{media-id}/likes 的端点 这是我到目前为止写的,但它一直给我状态码 = 400。
String url =String.format("%s/media/%s/likes",ConnectionConstants.API_URL, media_id);
HttpClient httpclient = new DefaultHttpClient();
final HttpPost postRequest = new HttpPost(url);
try {
HttpResponse response =httpclient.execute(postRequest);
final int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
return null;
}
final HttpEntity entity = response.getEntity();
if (entity != null) {
...
return true;
}
}
} catch (Exception e) {
postRequest.abort();
}
return null;
}
【问题讨论】:
标签: android http-post instagram-api