2012-01-10 157 views
1

有人可以告訴我「如何獲得」或「什麼是」在院子裏的文檔http://rubydoc.info/github/Instagram/instagram-ruby-gem給出的紅寶石instagram api方法location(id), location_recent_media(id,options{}), media_item(id), media_likes(id)等使用的'id'參數?我正在使用rails,並且使用gem安裝api。如何從instagram api獲取'id'參數?

+0

[如何獲取用於訪問instagram中用戶詳細信息的'id'](http://stackoverflow.com/questions/8800459/how-to-get-the-id-for-accessing-user-詳細功能於Instagram的) – 2012-01-10 12:38:30

回答

1

你可以看到如何在這裏使用API​​ https://github.com/Instagram/instagram-ruby-gem的例子,看看代碼我會說,ID是依賴於你正在查詢,如果你使用的位置(ID)它會是位置的ID。現在,要從「真實世界」位置獲取該ID,我相信您可以使用location_search(經度,緯度),這將爲您提供一個數組,其中包含所有與該座標接近的位置,例如(來自代碼文檔):

Instagram.location_search("37.7808851", "-122.3948632") 

這會給你一個陣列周圍的位置37.7808851,-122.3948632(164 S公園,SF,CA美國)。

然後你可以使用IDS進行陣列與位置(ID),e.g:

mylocations = Instagram.location_search("37.7808851", "-122.3948632") 
Instagram.location(mylocations.first) 

希望它能幫助。