【问题标题】:How to get 'id' parameter from the instagram api?如何从 instagram api 获取“id”参数?
【发布时间】:2012-01-10 10:44:11
【问题描述】:
【问题讨论】:
标签:
ruby-on-rails
ruby
instagram
【解决方案1】:
您可以在此处https://github.com/Instagram/instagram-ruby-gem 中查看如何使用 API 的示例,查看代码我会说 id 取决于您查询的内容,如果您使用 location(id) 它会是位置的ID。现在,要从“真实世界”位置到该 id,我相信您可以使用 location_search(longitude, latitude),这将为您提供一个包含所有靠近该坐标的位置的数组,例如(来自代码文档):
Instagram.location_search("37.7808851", "-122.3948632")
这将为您提供一个包含 37.7808851、-122.3948632(164 S Park, SF, CA USA)周围位置的数组。
然后您可以使用带有 location(id) 的 id 数组,例如:
mylocations = Instagram.location_search("37.7808851", "-122.3948632")
Instagram.location(mylocations.first)
希望对你有帮助。