Is there any way that i can retrieve account_id from google contact api v3 to make a get request to google people api? - google-contacts-api

I have retrieved all my contacts using Google Contact API. Now, i want to get the google profile info of all those contacts using the get request as mentioned in this People API GET link. But i do not see any id in the response to make a request.

The Contacts API and People API are separate API's not meant to interop with each other.
That said, the reverse engineered way to do this is to take the Contacts API contact ID, parse that hexadecimal value, convert it to decimal, and add a 'c' prefix to it, and that becomes the People API person resource ID.
e.g. if the Contacts API contact ID was 100, then the People API person ID would be c256. When you fetch contacts from the People API in this fashion, it'll have the joined profile information, if present.

Related

How to get Google reviews for a business without specific address and placeId?

Right now, we have a flow, where we import Google reviews on sign up and then update them daily. We get the user's company name and location address:
$requestUri = 'https://maps.googleapis.com/maps/api/place/autocomplete/json?key={key}&input=A+Closer+Look+Residential+Inspections%2C+LLC%2C+9230+Fowler+Ln%2C+Lanham%2C+MD+20706%2C+United+States';
From autocomplete we can get placeId and search for reviews by placeId:
$requestUri = 'https://maps.googleapis.com/maps/api/place/details/json?key={key}&place_id=ChIJmyUG8bfBt4kRqqn8jPZYhDo';
And this worked fine.
Issue
We have a new user which dont have location address, so we can't get placeId. The user has reviews on Google if to search for them in the search bar.
Company name is: "Westside Home Inspections Inc.". Google Map shows that they works in whole LA (not address, but area). Then i tried to get a placeId here: https://developers.google.com/maps/documentation/places/web-service/place-id . But with no luck.
Question:
Is this possible to get Google reviews only by company name?
If company has no address, then it's SAB (service area business).
And looks like Google Places API excluded support for SABs from their Places Api:
The Places API team has reviewed this feature request and decided against including Service Area Businesses results in API responses. Places API mission is to enable developers to help users find relevant places to visit. Since Service Area Businesses are not places users can visit, and therefore do not belong in the Places API.
More details here: https://issuetracker.google.com/issues/35828187#comment20
And if to get reviews we need to use placeId, then its not possible to get reviews.
Answer: No, its not possible to get Google reviews for SAB, because Google removed support of SAB in Google Places Api.
PS: I think, it's possible that we can get reviews for SAB in the "Google Business Profile", but this is not our case and is a different story.
Thanks to #MrUpsidown for helpful link in comments.

Google Contacts API V3 not returning title for automatic contact entries

I have an app that fetches a user's contacts from the Google Contacts V3 API after the user authenticates via OAuth2 (the requests are made using JSON). While my code works great in most circumstances, I have noticed that the API returns an empty title hash for contacts that get created automatically through emailing an address for the first time, which is less than ideal.
When I view "Other Contacts" under Google Contacts (where Google assigns these automatic contacts), these contacts seem to have an accurate title attribute. Is there a way I could potentially get access to this value? The response body doesn't seem to return this value within a contact entry.
Thanks.

Retrieve Google Contact create date

I need to retrieve the creation date of a Google Contact.
I know that I can use getLastUpdated() to get the last modified date, but I need the create date.
Is there any solution to this?
You can use Google Contacts API. From the response body you will be able to get the created date. Also this post from stackexchage suggested to use API Playground to visually walk through making a request to get the data you want from Google Contacts API.
This information is not traditionally exposed through the Google
Contacts online interface. However! You can get access to "created"
and "updates" dates and times using the Google Contacts API.
If you're not a developer, you can use the API Playground to visually
walk you through making a request to the Google Contacts API to get
the data you want.

Is there any way to get other contacts from Google People API? [duplicate]

I'm having a problem with the 2 APIs above. Given the next scenario: I have 2 different google accounts. One that doesn't use Google+ and a second account that uses Google+
When using Contacts API on the first account that doesn't use Google+ I can see all my contacts:
GET /m8/feeds/contacts/<email>/full
Same for the second account that uses Google+.
When I'm using People API for the first account that doesn't use Google+, I'm getting an empty response (actually I'm getting just the next sync token:
GET https://people.googleapis.com/v1/people/me/connections
With the next scope:
https://www.googleapis.com/auth/contacts
Returns:
{
"nextSyncToken": "CMe6...."
}
The same call for the second account (with Google+) works like a charm
The only difference between the 2 accounts is Google+, is it possible that People API only works for accounts with Google+? Or is it something else that I'm missing
I found the difference between the 2 APIs and it has nothing to do with the fact that one of the accounts is connected to Google+ or not
People API will only fetch the contacts that are under the account "My contacts" contacts, while Contacts API will also fetch the other contacts lists ("Other contacts", "Most contacts", ...)
The People API is the newer version.
From Google APIs related to People API page:
The Google Contacts API will be deprecated in the future. The People API is the recommended replacement for apps that read contact data.
It is also important to note that the People API does in fact allow the developer to use "other contacts" just like Contacts API did. In addition, when migrating you should not have to re-ask for user consent to the following:
https://www.google.com/m8/feeds
https://www.googleapis.com/auth/contacts
https://www.googleapis.com/auth/contacts.readonly
Please see these links for further reading:
https://developers.google.com/people/related-apis (Contacts API vs People API)
https://developers.google.com/people (Intro to People API)
I basically just copy/pasted most of this stuff but hopefully, some people find this helpful as I too was curious to find these answers :)

Where to place API key for Google Geocoding API?

We use Google Geocoding API to map address to Latitude and Longitude.
Here is the sample URL for encoding (which returns json) -
http://maps.googleapis.com/maps/api/geocode/json?address=Dallas&sensor=false
Message: OVER_QUERY_LIMIT
Ok, it makes sense, because we exceed over 2500 daily limit so we place API key like this -
http://maps.googleapis.com/maps/api/geocode/json?key=xxxxx&address=Dallas&sensor=false
Message: REQUEST_DENIED
I'm wondering where/how to place the API Key.
Looks like in version 3 you need to pass the ClientID in the URL and not a key as you do in the free version: https://developers.google.com/maps/articles/v2tov3#newkey
So your URL should look like: http://maps.googleapis.com/maps/api/geocode/json?client=xxxxx&address=Dallas&sensor=false
Not lucky enough to have a paid account so I cannot test - but I think that will get you on the correct path.
Relevant from this link: https://developers.google.com/maps/documentation/business/webservices/
Client ID
You must include your client ID in all API requests. Your client ID
identifies you as a Maps API for Business customer and enables support
and purchased quota for your application. Requests made without a
client ID are not eligible for Maps API for Business benefits.
If you're switching from the free API services to a Maps API for
Business implementation, you must remove the key parameter from your
requests. Google Maps API web services will deny requests made with
both a client ID and a key.
More information is available in the Authentication and Authorization
chapter of this guide.
If you have lost your client ID, you can recover it by logging in to
the support portal and clicking Maps: Add URLs from the links on the
left of the page.
EDIT
For more information, including instructions on passing your client ID to the Earth API, v2 API, and the Maps API for Flash, please read Loading Client-side APIs.
If you have lost your client ID or cryptographic key, you can recover them by logging in to the support portal and clicking Maps: Add URLs from the links on the left of the page.