Getting cover photos with Google+ Search API results - javascript

I am trying to search Google+ accounts through the Javascript API but even when supplying fields param and telling it to retrieve cover photos it still doesn't retrieve it.
Example search API call with cover field selected
Any idea if this limitation is part of the Google+ search API? This doesn't seem to happen in the people.get calls.

The people search returns only limited information about the person. You need to take the ID returned from People search and call People get.
From the documentation: People: search
items[] list The people in this page of results. Each item includes
the id, displayName, image, and url for the person. To retrieve
additional profile data, see the people.get method.
People: get
If successful, this method returns a person resource in the response body.
"cover": {
"layout": "banner",
"coverPhoto": {
"url": "https://lh4.googleusercontent.com/-G93N-0rUMcU/U8z2FJW_eNI/AAAAAAAAKe0/zcIwm7NmPRc/s630-fcrop64=1,003a0000ffc4ffff/LindaLawtonGoogleplusCover.png",
"height": 528,
"width": 940
},

Related

google API places ID cant find the id

I'm trying to get the place ID from a business on google.
I've searched it in this widget but it does not show
https://developers.google.com/maps/documentation/places/web-service/place-id
I followed this site
https://www.launch2success.com/guide/find-any-google-id/
and I get returned this from my request, any ideas?
{
"error_message": "The provided Place ID is no longer valid. Please refresh cached Place IDs as per https://developers.google.com/maps/documentation/places/web-service/place-id#save-id",
"html_attributions": [],
"status": "NOT_FOUND"
}

How to get views and comment count when using Youtube data api -v3 playlistItems

I'm trying to get some data using Youtube data api -v3 playlistItems. I'm able to get all the data that comes with playlistItems perfectly. However, I need more data than what playlistItems offers. For example, I would like to get the view counts, comment count, and all the statistics
I know I could use /youtube/v3/videos to get the statistics but I have been trying this and it is not working for me. Please help. Thanks.
export function buildVideosRequest(amount = 12, loadDescription = false, nextPageToken) {
let fields = 'nextPageToken,prevPageToken,items(contentDetails/videoId,id,snippet(channelId,channelTitle,publishedAt,thumbnails/medium,title)),pageInfo(totalResults)';
if (loadDescription) {
fields += ',items/snippet/description';
}
return buildApiRequest('GET',
'/youtube/v3/playlistItems',
{
part: 'snippet,contentDetails',
maxResults: amount,
playlistId: 'PLvahqwMqN4M0zIUkkXUW1JOgBARhbIz2e',
pageToken: nextPageToken,
fields,
}, null);
}
Upon invoking the PlaylistItems.list endpoint, you obtain a result set of which each item is a playlistItems resource JSON object.
That JSON object doesn't contain the info you're interested in (view count, comment count, etc). This kind of info -- as you alluded yourself -- is obtainable through the Videos.list API endpoint.
That is that you have to collect all video IDs that you're interested in into an array, then invoke repeatedly the Videos.list endpoint, passing to it an id parameter assigned properly.
Note that this endpoint's id property allows you to reduce the number of endpoint calls, since the id may be specified as a comma-separated list of video IDs (at most 50). Hence, if you have for example an array of 114 video ID's, then you may issue only 3 calls to Videos.list.

How to get all google reviews using business api

I need all google reviews for particular location but I am unable to use business api from google. Here is url for get request
https://mybusiness.googleapis.com/v3/accounts/account_name/locations/location_name/reviews
Now my question is what is the value for param account_name and location_name
How can I get that.
Please answer with sample location example
I think first of all you need to white list your google my business api for whatever project you are working on in your project as its private api. Google my business api will work on the locations associated with your account so make sure you verified the LOCATIONS from any account you know. Then you can try out the api call you mentioned in OAuthplayground.
Follow steps mentioned in below documentation URL to set it up:
https://developers.google.com/my-business/content/prereqs
After the setup and etc you will automatically understand the account id and location id.
Also few more urls you can go to understand it better.
https://console.developers.google.com (here you will setup your project)
https://business.google.com/manage (here you will add/can see the locations - for which you need reviews)
https://developers.google.com/my-business/content/basic-setup (Steps after completing the prereq)
https://developers.google.com/oauthplayground (You will test the my
business api here after approval)
When you make a request to https://mybusiness.googleapis.com/v3/accounts it gives you a list of accounts. On those accounts they have a field called name. That field is accounts/account_name.
{
"state": {
"status": "UNVERIFIED"
},
"type": "PERSONAL",
"name": "accounts/1337",
"accountName": "example"
}
When you make a request to https://mybusiness.googleapis.com/v3/accounts/account_name/locations it gives you a list of locations. On those locations they have a field called name. That field is accounts/account_name/locations/location_name.
{
"locations": [
{
"languageCode": "en",
"openInfo": {
"status": "OPEN",
"canReopen": true
},
"name": "accounts/1337/locations/13161337",
...
}

GMail API Users.threads.list Missing "Messages" Field

I'm able to use GMail's Users.threads.list API call to retrieve a list of the threads. I'd like to also grab the labels belonging to each message in the thread.
On the official documentation / live example for this method, there is an area called fields where the user can specify the optional fields they wish to pull in. They even provide a little UI tool call 'fields editor' to help you select and properly format the fields for inclusion in the REST query:
Which results in the following, valid, generated fields parameter values:
nextPageToken,resultSizeEstimate,threads(historyId,id,messages/labelIds)
The final request looks like this:
GET https://www.googleapis.com/gmail/v1/users/me/threads?includeSpamTrash=true&fields=nextPageToken%2CresultSizeEstimate%2Cthreads&key={YOUR_API_KEY}
After authenticating with OAuth2, I get back a list of threads[], but none of them include the expected messages[] array nested within them! I know the field mask is valid because GMail API errors out when you request a field the method doesn't support with a standard HTTP 400 and a pretty printed error message. But in this case, all I get back is an object that contains an array labeled "threads", where each thread object only has the following fields:
id
snippet
historyId
But no messages array. Stranger yet, even when I remove the fields custom filter parameter, I still get back these same results. Am I missing something obvious here?
You have to list the id of the threads first, and then make a separate request to get the thread and fields in the messages you want. The API Explorer allows you to select additional fields when listing for some reason.
1. List ids
Request
GET https://www.googleapis.com/gmail/v1/users/me/threads?access_token={access_token}
Response
{
"threads": [
{
"id": "1570f8c16a1084de",
"snippet": "Foo bar...",
"historyId": "1234"
}, ...
],
"resultSizeEstimate": 100
}
2. Get the thread
Request
GET https://www.googleapis.com/gmail/v1/users/me/threads/1570f8c16a1084de?access_token={access_token}
Response
{
"id": "1570f8c16a1084de",
"historyId": "1234",
"messages": [
{
"id": "1570f8c16a1084de",
"threadId": "1570f8c16a1084de",
"labelIds": [
"INBOX",
"IMPORTANT",
"CATEGORY_FORUMS"
], ...
}
}
If you don't want to list threads and then get them all separately, you could use batch requests to bring it down to 2 requests instead.

Getting like and comment counts per post of facebook page by graph api version 2

I have been getting like and comment counts per post of facebook page/group feed call by graph api separately using FQL but as version 2 of graph api released fql no longer working to serve purpose.
So i have to find new ways to get comment and like counts per post of page feed display. I will make a separate call to get comment and like counts per post of the fb page as it may not be possible to get things in same page feed call(or it is?).
So, searching through google, i found following way using graph api call -
..page_id/feed?fields=likes.limit(1).summary(true){id},comments.limit(1).summary(true)&limit=10
Is this the best and error free way?? Also besides id and summary fields i also get created_time, paging, likes data by the above call which is unexpected and redundant, how do i exclude these additional fields?
So please any FB employee show me light on what is the best way to retrieve like and comment count per post of page/group feed using graph api version 2.
If you want to retrieve Likes and comments count of a post on FB you can achieve this by using Id of the post Like this
..Your_Post_ID?fields=likes.limit(0).summary(true),comments.limit(0).summary(true)
the result will contain
Total numbers of likes of the post, total numbers of comments of the post, post ID and post created time.
The result will be like this
{
"likes": {
"data": [
],
"summary": {
"total_count": 550
}
},
"comments": {
"data": [
],
"summary": {
"order": "chronological",
"total_count": 858
}
},
"created_time": "2014-10-12T05:38:48+0000",
"id": "Your_Post_ID"
}

Categories