Pergunta

Can someone tell me "how to get" or "what is" the 'id' parameter that is used in the ruby instagram api methods location(id), location_recent_media(id,options{}), media_item(id), media_likes(id) etc given in the yard documentation http://rubydoc.info/github/Instagram/instagram-ruby-gem ? I am using rails and the api is installed using gem.

Foi útil?

Solução

You can see an example of how to use the API in here https://github.com/Instagram/instagram-ruby-gem, taking a look at the code I would say that the id is dependent on what you are querying, if you are using location(id) it would be the id of the location. Now, to get from a "real world" location to that id I believe you can use location_search(longitude, latitude) and that would give you an array with all the locations close to that coordinates, e.g (from the code documentation):

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

That would give you an array with the locations around 37.7808851, -122.3948632 (164 S Park, SF, CA USA).

Then you can use that array of ids with location(id), e.g:

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

Hope it helps.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top