如何通过 instagram api 点赞媒体?不断获取 statusCode = 400
How to like a media via instagram api?Keep getting statusCode = 400
我正在尝试在 android 上实现 Instagram 媒体点赞。这是我要 POST 到 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;
}
好的,我知道出了什么问题。最后应该有access_url,作为url
的一部分
String url =String.format("%s/media/%s/likes?access_code=%s",ConnectionConstants.API_URL, media_id,access_code);
我正在尝试在 android 上实现 Instagram 媒体点赞。这是我要 POST 到 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;
}
好的,我知道出了什么问题。最后应该有access_url,作为url
的一部分String url =String.format("%s/media/%s/likes?access_code=%s",ConnectionConstants.API_URL, media_id,access_code);