Retrieve user friends media in instgram API - media

How to retrieve user friends media in Instagram?
There is no implementation to do this in Instagram documentation.

You will need to use multiple endpoints to do this.
Get a list of an authenticated user's followers: https://instagram.com/developer/endpoints/relationships/#get_users_followed_by
Get a list of users followed by the authenticated user: https://instagram.com/developer/endpoints/relationships/#get_users_follows
Loop through followed by and followers and get media for each user: https://instagram.com/developer/endpoints/users/#get_users_media_recent
You will only get media for users with public profiles.

Related

youtube Channel data list API for need channel owner details

I need to get owner details like email/username/name of the channel using youtube data API. I've checked the document. Can you please suggest a way how I can get these details for the same?
Email address - emails are usually hidden by a button protected by reCaptcha
Thanks,
AR
If you check the documentation for channels#resource you will notice that the fields you are looking for
email
username
name
Do not exist there is no way to find out the owner of a YouTube channel via the YouTube API even if you are authenticated as that user. If you did authorize the user you could add the profile and email scopes and this would give you access to the Google People API and you would be able to find that information there.
If you are not authorizing the user then there is no way you are going to get private personal information about a user from a public api endpoint.

Using Algolia to get timeline posts filtering by user permission

I am building a social network web site. In my social network user can set access permission for their own post. For example like facebook, they can set permission only friends, only me, public, custom. I am using the Algolia search engine to filter the posts for the user. When a user creates a post, I will save the post with the permission field which is public or friends and other. If it's friends I will add his/her friends ids in another filed named accessList.
Post {
id: 'postId1334'
text: 'This is a test'
permission: 'Friends'
accessList: ['userId1', 'userId123', 'userId2341', 'userId13455']
}
When a user opens the timeline I will query with the filter= permission: Public OR accessList: currentUserId which means find the posts which have ``public permissionor current user identifier includes the postaccess list`.
Everything working well until we have changed in user friend list. If the user removes or adds a new user to his/her friend list they can see or not see some posts which saved with the permission of Only Friends. For this case, any change on user friend list I have to update all user posts accessList adapt with new friend list.
Is there another way to set permission for user access posts?
Or I need to use another kind of data structure?
Or maybe I need to change my query filter?
I do not see any need for change in the data structure. Because Algolia is schemaless, the structure you describe is how you will replicate the "association" between Post and access list Users.

How to select particular account while making oauth api call in google?

For Eg: Using google drive api i made an API call to get permission from user and generate access token and got user details using that token. In that case before getting permission from user if i logged in into multiple google accounts in my browser and i tried through particular mail Id through my app. I need to display only that mail id for permission , Not to display all the logged in mail ids. How to filter for particular mail id through api call.
My sample api call:
https://accounts.google.com/o/oauth2/auth?client_id=CLIENT_ID +&redirect_uri=REDIRECT_URI &scope=email+profile+https://www.googleapis.com/auth/drive&response_type=code&access_type=offline
I just removed prompt=select_account keyword from this api call. but it still display all accounts. How to filter for particular mail id?
You add the login_hint parameter with an account value to the authentication request.

Getting user gender via spring social for facebook

We have developed an app that let user login with facebook. The app has been granted all required permissions to retrieve name, email, gender and age range etc. But our app developer stored only id,name and email while user login. Now we need to retrieve gender and age range of all those users who have logged in the app.
Is there a way to rerun user query to retrieve those data? I am looking to develop an program using Spring-social and RestFB but it needs user login action to retrieve required data which is problem in our case since we cannot recreate login action again.
As long as the user granted public_profile permission to your app, and you have their app-scoped user id, you can make the API call using your app access token.
And if you are looking to request this data for a lot of users, then you should optimize your requests in the following ways:
request the fields you need only: /user-id?fields=id,gender
request data for multiple users in one go: /?ids=user-id-1,user-id-2,user-id-3&fields=fields=id,gender – https://developers.facebook.com/docs/graph-api/using-graph-api/v2.5#multirequests
perhaps even use Batch Requests if necessary, https://developers.facebook.com/docs/graph-api/making-multiple-requests/

Spring Social Facebook: how to get post's owner which is liked by authenticated user

I have developed a Spring application which uses Spring Social Facebook, in order to get users activities in social network.
I need to know how i can get post's owner which is liked by authenticated user, and which permission is required to perform this operation.
For sake of clarity: User A (authenticated) likes a post belonging to user B. How i can get user B?
Any ideas?
Here you have url from facbook api explorator
me/posts?fields=from,message,picture,icon
This rest execution should return all posts - posted by current user and other users which was liked by him/her. Know you have to write it in Java, below code fetches data from the specified connection.
facebook.fetchConnections(null, "music", Page.class,
new PagingParameters(25, 0, null, null).toMap(), "from,message,picture,icon")
You can also try (but this I haven't tested)
facebook.fetchConnections(null, "posts", Post.class)

Resources