Comment obtenir le « id » pour accéder à des détails de l'utilisateur dans instagram

StackOverflow https://stackoverflow.com/questions/8800459

  •  25-10-2019
  •  | 
  •  

Question

Comment puis-je obtenir le id pour accéder à informations de l'utilisateur par la méthode (Hashie::Mash)user(id) de l'API ou d'accéder à son instagram / son emplacement par (Hashie::Mash)location(id)?

J'utilise des rails pour mon projet.

Était-ce utile?

La solution

You can search for a user to get his/her id, e.g:

shaynesids = Instagram.user_search("Shayne Sweeney")

That will give you all the ids on an array of user matching Shayne Sweeny (hopefully just one), then you can use it with user(id), like this:

myuser = Instagram.user(shaynesids.first)

Note: In here I'm assuming that the search it's gonna return at least one result, you will need to be careful in your code to account for errors, because it could return an empty array.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top