2013-12-09 238 views
1

目前,我可以在我的應用中獲取登錄用戶的照片。但我想從我的Instagram開發者帳戶中獲取照片,並在其中註冊了我的應用。這可能嗎?目前,從Instagram獲取照片

NSString *urlString=[NSString stringWithFormat:@"https://api.instagram.com/v1/users/self/feed/?access_token=%@",appDelegate.instagram.accessToken]; 

獲取登錄用戶的詳細信息。但我想從我客戶的Instagram帳戶中獲取照片。使用客戶端用戶名替換上面的url中的'self'不起作用。有任何想法嗎 ?

+0

我認爲你需要與你的客戶的帳戶登錄:)! – Maulik

+0

你誤會了。該應用程序的用戶應該能夠看到客戶端的照片。 – mak

+0

客戶端是要求我構建應用程序的人 – mak

回答

3

您不能使用/users/user-id/media/recent端點嗎?

來自實例Instagram API Documentation,得到飼料的用戶ID = 3,使用以下

https://api.instagram.com/v1/users/3/media/recent/?access_token=ACCESS-TOKEN 

返回

{ 
    "data": [{ 
     "comments": { 
      "data": [], 
      "count": 0 
     }, 
     "caption": { 
      "created_time": "1296710352", 
      "text": "Inside le truC#foodtruck", 
      "from": { 
       "username": "kevin", 
       "full_name": "Kevin Systrom", 
       "type": "user", 
       "id": "3" 
      }, 
      "id": "26621408" 
     }, 
     "likes": { 
      "count": 15, 
      "data": [{ 
       "username": "mikeyk", 
       "full_name": "Mike Krieger", 
       "id": "4", 
       "profile_picture": "..." 
      }, {...subset of likers...}] 
     }, 
     "link": "http://instagr.am/p/BWrVZ/", 
     "user": { 
      "username": "kevin", 
      "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_3_75sq_1295574122.jpg", 
      "id": "3" 
     }, 
     "created_time": "1296710327", 
     "images": { 
      "low_resolution": { 
       "url": "http://distillery.s3.amazonaws.com/media/2011/02/02/6ea7baea55774c5e81e7e3e1f6e791a7_6.jpg", 
       "width": 306, 
       "height": 306 
      }, 
      "thumbnail": { 
       "url": "http://distillery.s3.amazonaws.com/media/2011/02/02/6ea7baea55774c5e81e7e3e1f6e791a7_5.jpg", 
       "width": 150, 
       "height": 150 
      }, 
      "standard_resolution": { 
       "url": "http://distillery.s3.amazonaws.com/media/2011/02/02/6ea7baea55774c5e81e7e3e1f6e791a7_7.jpg", 
       "width": 612, 
       "height": 612 
      } 
     }, 
     "type": "image", 
     "users_in_photo": [], 
     "filter": "Earlybird", 
     "tags": ["foodtruck"], 
     "id": "22721881", 
     "location": { 
      "latitude": 37.778720183610183, 
      "longitude": -122.3962783813477, 
      "id": "520640", 
      "street_address": "", 
      "name": "Le Truc" 
     } 
    }, 
    { 
     "videos": { 
      "low_resolution": { 
       "url": "http://distilleryvesper9-13.ak.instagram.com/090d06dad9cd11e2aa0912313817975d_102.mp4", 
       "width": 480, 
       "height": 480 
      }, 
      "standard_resolution": { 
       "url": "http://distilleryvesper9-13.ak.instagram.com/090d06dad9cd11e2aa0912313817975d_101.mp4", 
       "width": 640, 
       "height": 640 
      }, 
     "comments": { 
      "data": [{ 
       "created_time": "1279332030", 
       "text": "Love the sign here", 
       "from": { 
        "username": "mikeyk", 
        "full_name": "Mikey Krieger", 
        "id": "4", 
        "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1242695_75sq_1293915800.jpg" 
       }, 
       "id": "8" 
      }, 
      { 
       "created_time": "1279341004", 
       "text": "Chilako taco", 
       "from": { 
        "username": "kevin", 
        "full_name": "Kevin S", 
        "id": "3", 
        "profile_picture": "..." 
       }, 
       "id": "3" 
      }], 
      "count": 2 
     }, 
     "caption": null, 
     "likes": { 
      "count": 1, 
      "data": [{ 
       "username": "mikeyk", 
       "full_name": "Mikeyk", 
       "id": "4", 
       "profile_picture": "..." 
      }] 
     }, 
     "link": "http://instagr.am/p/D/", 
     "created_time": "1279340983", 
     "images": { 
      "low_resolution": { 
       "url": "http://distilleryimage2.ak.instagram.com/11f75f1cd9cc11e2a0fd22000aa8039a_6.jpg", 
       "width": 306, 
       "height": 306 
      }, 
      "thumbnail": { 
       "url": "http://distilleryimage2.ak.instagram.com/11f75f1cd9cc11e2a0fd22000aa8039a_5.jpg", 
       "width": 150, 
       "height": 150 
      }, 
      "standard_resolution": { 
       "url": "http://distilleryimage2.ak.instagram.com/11f75f1cd9cc11e2a0fd22000aa8039a_7.jpg", 
       "width": 612, 
       "height": 612 
      } 
     }, 
     "type": "video", 
     "users_in_photo": null, 
     "filter": "Vesper", 
     "tags": [], 
     "id": "363839373298", 
     "user": { 
      "username": "kevin", 
      "full_name": "Kevin S", 
      "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_3_75sq_1295574122.jpg", 
      "id": "3" 
     }, 
     "location": null 
    }, 
    ] 
} 
+0

但是,這會獲取在用戶個人資料中顯示的隨機照片,而不是用戶自己發佈的照片​​。 – mak

+0

葉..有幫助。顯然,我一直在使用用戶名而不是用戶名。現在明白了。 – mak

+0

很酷。評估用戶端點時,我也遇到過這種情況。 – Shiva