2016-01-31 150 views
4

當我試圖讓媒體發表評論時,它僅返回我訪問令牌擁有者用戶的評論,並且沒有其他用戶評論。獲取評論由instagram api

查詢:

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

所以最終的查詢是這樣的:

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

答:

`{"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"}]}' 

獲取媒體ID:

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

獲取媒體ID列表

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")); 
     } 
    } 

在哪裏我的錯誤或沙盒應用程序是Instagram的API限制?

回答

1

是的,在沙箱模式下,它將僅從沙箱授權用戶返回媒體,如果您添加了已經評論過沙箱的用戶,則該評論將顯示在API響應中。

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

爲了幫助您開發和測試您的應用程序,可 在沙盒模式的用戶和媒體是真正的Instagram的數據(也就是什麼常可見 是在Instagram的應用程序),但有以下條件:

  • 應用在沙箱從每個這些用戶的限制爲10個用戶
  • 數據被限制爲10個用戶和最近的20個媒體
  • 精簡API速率限制
+1

拿給我要其他網友的評論,以及如果它不是在沙盒模式 – NetStarter