Spring social vk (Vkontakte): How to fetch user photo albums - spring-social

im trying to integrate some spring social projects into my project and now im searching for a way how to get users photo albums from vk/vkontakte.
Getting the profile photo data is no problem as i can get it with the VKontakteProfile class.
As the api https://vk.com/pages?oid=-17680044&p=getProfiles offers such function i was searching a api method but couldn't find...

To get user albums you must have an access_token because typically most uf users hide their albums from not autorized people. You can get it by making OAuth-autorization with app created by you OR by this link:
https://oauth.vk.com/token?grant_type=password&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&username=YOUT_ACCOUNTS_LOGIN&password=YOUR_ACCOUNT_PASSWORD
This link uses by official vk android application to make "straight" autorization. Straight auth is allowed only to official apps like ios, android and windows phone app. So client_id and client_secret is data from android-application. It was extracted from decompiled app. Do not afraid: it will not be changed ever.
So, you made this GET request and got access_token in response if login data is correct.
Then you should use method photos.getAlbums like this:
https://api.vk.com/method/photos.getAlbums.xml?owner_id=YOUR_PAGE_ID&access_token=YOUR_ACCESS_TOKEN
As you can see, url contains ".xml". So if you want response to have JSON format just remove ".xml" from this url. But xml is more comfortable to parse I think.
Next if you need to get albums photo later you should use method photos.get. To use it you need albums identification numbers. In response of your last request this parameter is called "aid".
You can use regular expressions to grab these parameters from response, expression should be <aid>(.*?)<\/aid>
So next you making your request to get data from specific album:
https://api.vk.com/method/photos.get.xml?owner_id=YOUR_ACCOUNT_ID&album_id=PARSED_ALBUM_ID&access_token=YOUT_ACCESS_TOKEN
The same situation with "xml" response format. So you will see the list of objects "photo" which contains all data about this picture like it's ID in album, it's link on pictures (with different sizes), it's width, height, description, upload date and others.
Feel free to get any help about VK API from me.
The list of all methods that API has is here: https://vk.com/dev/methods

As far as I know, VK provides API for getting user albums.
photos.getAlbums API method stands for this function.
For example,
https://api.vk.com/method/photos.getAlbums/?owner_id=5369654&access_token=your_access_token
It works for me. Read more about it here:
https://vk.com/dev.php?method=methods#/dev/photos.getAlbums

Related

How to get access_token for replying review in Play Developer API?

This link: Reply to Reviews describes the way to retrieve and reply to reviews. The Google Play Developer Reply to Reviews API allows us to view user feedback for our app and reply to this feedback. But I am finding it difficult to get the authorization token. It says I should have got this when I get access to the API.
But after going to the link, I didn't find too many information on this, rather, it has another link which takes me to the page where I have already created a service account.
After summarizing, my question is - I have created a service account and downloaded the key as JSON. But how to get this access_token the given snapshot asking for? The JSON file itself doesn't contain such access_token, rather it contains other information including type, project_id, private_key, client_id etc.
The process is not described directly in the link given in the question. Rather we will follow the steps mentioned in Play Developer API | Authorization
The whole process actually has two major steps:
Making a OAuth 2.0 client ID and downloading it.
Using client_id, client_secret and redirect_uris from this download JSON file to make API call.
Making OAuth 2.0 client ID and getting parameters
In order to do this:
Go to Google Play Console.
Use your play console account to login into it.
Make sure the right project is selected, at top there is a drop-down, where the correct project is supposed to be selected.
Now from + CREATE CREDENTIALS button create a OAuth Client ID and after successful creation you will find it listed under Credentials tab. The Credentials tab is at the left side of the page.
Now download the OAuth Client ID and it will be saved as a JSON file.
Open the JSON file and collect the client_id, client_secret and redirect_uris from there. Here redirect_uris will contain a list of URLs. One of them is http://localhost, we don't need it. Please take the other one, somewhat like urn:ietf:wg:oauth:2.0:oob.
Now the second step begins:
Make the API call
Now go to the first link I provided in the answer, i.e: Play Developer API | Authorization. We just did the first step under initial configuration. Now the second step begins. Make sure you are using the same browser where you are already logged-in on Google Play Console.
Now fill-up the fields in this link as mentioned in the documentation
with the information we just got (client_id, client_secret,
redirect_uris), remove the ... and put your redirect_uri and
client_id there:
https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/androidpublisher&response_type=code&access_type=offline&redirect_uri=...&client_id=...
Now after filling up your credentials in this link provided paste this link to browser and go to this URL.
This may require you to authorize this request by signing in with your account (with the Google Play Console Account we are using so far).
After authorization you will be given a code parameter similar to 4/eWdxD7b-YSQ5CNNb-c2iI83KQx19.wp619..... (This is also mentioned in the documentation you may follow the steps there).
Now go to the step 4 in the documentation (following is a snapshot):
replace the credentials which are here inside <..> (including < and >) with the information we so far collected. Here <the code from the previous step> is nothing but the code parameter 4/eWdxD7b-YSQ5CNNb-c2iI83KQx19.wp619.... we got.
Now make this API call. To make this kind of API calls you may need to use Bulk edit of Postman software (download and install the software). But if you are not comfortable with this Bulk edit, I am giving you a similar form data in the following snapshot. Just fill up the fields there in Postman and make the API call, (Please note that the method is selected POST):
Also you need not change the grant_type (its value is authorization_code).
Now clicking Send you should get the response which will contain access_token. Following is a snapshot of the response that comes with the access_token we are looking for (snapshot got from the documentation):
This response will come only once (for a certain code), to get another response you may need another code. So, save this response as a JSON from Postman to use it further.
Now you are done! Use this access_token and make API calls to get reply to reviews. More details here. Also please note that you might not get any reviews at all with this call, as this reviews' responses only work for recent time. If you make some recent comment in Play Store under your desired app they will be returned but the older comments will not be returned as response and the response might be blank {} if there are no recent comments. As mentioned in the documentation:
Note: You can retrieve only the reviews that users have created or modified within the last week. If you want to retrieve all reviews for your app since the beginning of time, you can download your reviews as a CSV file using the Google Play Console.

In Brightcove, can I retrieve a video's thumbnail WITHOUT a media API token?

I would like to use Javascript to retrieve thumbnail URLs from Brightcove-hosted videos.
I can't see a way to do that without exposing my Media API token to the client browser. (The with-token method is documented here.)
I don't need a token to show the whole video, so it seems insane and unnecessary that I need a token to get the thumbnail url, which obviously I would want to show to the user anyway.
The only workaround I can devise is to create a middleman interface on the server. (The client JS makes a request to my server, which uses the token to request the thumbnail from BC, then returns it back to the JS.) That's just annoying.
Am I missing something? Is there an alternate way to retrieve video thumbnails in the client without exposing the Media API key?
According to Brightcove's support, they tell me that the answer is "NO".
They do recommend a server-side relay, which is what I ended up writing, and it works fine.
Disappointing, though.

Generate Google Photo link from Google Picasa Web API data call

I am currently trying to generate a url to link to a public Google Photos gallery. I am aware from some research that all calls regarding Google Photos go through the Picasa API. So, by running file_get_contents on the following URL, I have retrieved a full listing of all public albums on my user account
http://picasaweb.google.com/data/feed/api/user/<USERNAME>?alt=json&kind=album&hl=en_US
This works perfectly and includes links to the gallery in Picasa. However, I would much prefer to be able to generate a link to the corresponding Google Photos gallery. On sharing Google photos, a shortened url is generated, like
https://goo.gl/photos/code
I was wondering if there was any possible way, given the album ID from the API call that such a link could be generated
Previous questions on this subject haven't generated much response unfortunately - is anyone aware of any such Google link generation capability?

Searching for Google+ Attachment

Google plus allows for the sharing of a url; and this gets added an activity as an attachment in the activity data. Is there a way when using Activities.Seach() to target the search to the attachment url? I can share a url on g+ and if the url is part of the comment of my post then I can then pull that post when using the activities.search; however if the url is only contained in the attachment, I can't pull any activities with that url. Is there something I'm missing? Any suggestions?
This is actually a known issue with google plus, one that has been requested quite a bit from the development community. https://code.google.com/p/google-plus-platform/issues/detail?id=57
The only real option at this time it to get an aggregate count of +1s and shares as shown here: http://www.helmutgranda.com/2011/11/01/get-a-url-google-count-via-php/

Possible to post URL and phone number to Google Places via API?

at www.movylo.com we're trying to integrate Google Places. We let merchants create a mobile store and want to post the store via APIs to Google Places. IT seems we can't post more than name of direction, so not possible to send URL, phone number, ...Anyone can help?
I looked into the same thing in the past but it looks like the only items you can add are the location, name and type, at least for now that is.

Resources