![](/img/trans.png)
[英]How can I get username and/or id through Instagram API in Ruby?
[英]How to get 'id' parameter from the instagram api?
有人可以告訴我“如何獲取”或“是什么”在ruby instagram api方法中使用的“ id”參數location(id), location_recent_media(id,options{}), media_item(id), media_likes(id)
等在院子文檔http://rubydoc.info/github/Instagram/instagram-ruby-gem中給出 ? 我正在使用rails,並且使用gem安裝了api。
您可以在此處https://github.com/Instagram/instagram-ruby-gem上看到如何使用API的示例,看看代碼,我會說id取決於您要查詢的內容,如果您正在使用location(id),它將是位置的ID。 現在,要從“現實世界”位置獲取該ID,我相信您可以使用location_search(經度,緯度),這將為您提供一個數組,其中所有位置都靠近該坐標,例如(來自代碼文檔):
Instagram.location_search("37.7808851", "-122.3948632")
這樣就可以為您提供一個陣列,其位置在37.7808851,-122.3948632(164 S Park,SF,CA USA)附近。
然后,您可以將ID數組與location(id)一起使用,例如:
mylocations = Instagram.location_search("37.7808851", "-122.3948632")
Instagram.location(mylocations.first)
希望能幫助到你。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.