如何通过instagram api喜欢媒体?继续获取statusCode = 400

时间:2015-04-05 14:32:40

标签: android http-post instagram-api

我正在尝试在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;
        }

1 个答案:

答案 0 :(得分:0)

好的,我已经弄清楚出了什么问题。最后应该有access_url,作为url

的一部分
String url =String.format("%s/media/%s/likes?access_code=%s",ConnectionConstants.API_URL, media_id,access_code);