How to get the 'id' for accessing user details in instagram
-
25-10-2019 - |
문제
How do i get the id
for accessing user info by (Hashie::Mash)user(id)
method of the instagram API or accessing his/her location by (Hashie::Mash)location(id)
?
I am using rails for my project.
해결책
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.
제휴하지 않습니다 StackOverflow