Get comments from instagram api

When I try to get comments on multimedia, it returns to me only the comments of users who own access tokens and no other user comments.

Request:

https://api.instagram.com/v1/media/"+mediaId+"/comments?access_token="+token

So the final request looks like this:

https://api.instagram.com/v1/media/1162251688307718037_1824437940/comments?access_token=token

Answer:

`{"meta":{"code":200},"data":[{"created_time":"1453069290","text":"comment_text_here","from":{"username":"username","profile_picture":"profile_picture","id":"user_id","full_name":"full_name"},"id":"1164752089812694405"}]}'

Get media ID:

https://api.instagram.com/v1/users/self/media/recent/?access_token="+token+"&count=30

Retrieving a list of media identifiers

JSONObject json = new JSONObject(comments);
    JSONArray data = json.getJSONArray("data");
    if (data.length()>0) {
        for (int i = 0; i < data.length(); i++) {
            JSONObject obj = (JSONObject) data.get(i);
            list.add(obj.getString("id"));
            //System.out.println(obj.getString("id"));
        }
    }

Where is my mistake or is it the instagram api limits for the sandbox app?

+4
source share
1 answer

Yes, in sandbox mode, it will only return media from authorized users, if you add a user who commented on your sandbox, then this comment will appear in the API response.

https://www.instagram.com/developer/sandbox/

, Sandbox - Instagram ( , Instagram), :

  • 10 .
  • 10 20 .
  • API
+1

Source: https://habr.com/ru/post/1626728/


All Articles