Instagram Rest API用户关系 - 关注/取消关注错误

时间:2014-11-19 11:05:19

标签: android instagram asynchttpclient

我遇到了Instagram问题。我正在请求目标用户关注/取消关注。  我用两种方式累了。他们都没有工作。

AsyncHttpClient client = new AsyncHttpClient();
        client.setTimeout(Constant.TIMEOUT);

1

client.post(
                    "https://api.instagram.com/v1/users/"
                            + userid2
                            + "/relationship?"+ "access_token="
                            + Utils.getFromUserDefaults(mcontext,
                                    Constant.PARAM_ACCESSTOKEN)+"&ACTION=follow",
                    new FollowInstagramResponseHandler(true, position, holder));

但是网址在浏览器中工作

错误:

{"meta":{"error_type":"APIInvalidParametersError","code":400,"error_message":"please supply action=follow,unfollow,approve,ignore,block,unblock"}}

2

RequestParams params = new RequestParams();
    params.put("ACTION","follow")

client.post(
                "https://api.instagram.com/v1/users/"
                        + userid2
                        + "/relationship?"+ "access_token="
                        + Utils.getFromUserDefaults(mcontext,
                                Constant.PARAM_ACCESSTOKEN), params,
                new FollowInstagramResponseHandler(true, position, holder));

得到与1相同的错误。

请帮帮我。

1 个答案:

答案 0 :(得分:0)

哈哈哈。当我将params键/值对更改为小写/大写字母时,它可以工作。

   RequestParams params = new RequestParams();
        params.put("action","follow")//Caps to small. :O

client.post(
                "https://api.instagram.com/v1/users/"
                        + userid2
                        + "/relationship?"+ "access_token="
                        + Utils.getFromUserDefaults(mcontext,
                                Constant.PARAM_ACCESSTOKEN), params,
                new FollowInstagramResponseHandler(true, position, holder));