【问题标题】:How to like a media via instagram api?Keep getting statusCode = 400如何通过 instagram api 点赞媒体?不断获取 statusCode = 400
【发布时间】: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


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-24
      • 1970-01-01
      • 2015-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多