Reputation: 12446
I need to read addresses of "other contacts". Docs say that in order to do this, READ_SOURCE_TYPE_PROFILE
should be set. However, when doing it like this:
service = googleapiclient.discovery.build('people', 'v1', credentials=credentials)
resource = service.otherContacts()
request = resource.list(
readMask='names,emailAddresses,phoneNumbers,addresses',
sources='READ_SOURCE_TYPE_PROFILE',
pageSize=1000
)
request.execute()
... I am getting the following error: Must request READ_SOURCE_TYPE_CONTACT
. Full traceback:
Traceback (most recent call last):
File "C:\Users\Leo\workspace\gapitest\main.py", line 22, in <module>
response = request.execute()
File "C:\Users\Leo\workspace\gapitest\venv\lib\site-packages\googleapiclient\_helpers.py", line 131, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\Leo\workspace\gapitest\venv\lib\site-packages\googleapiclient\http.py", line 937, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://people.googleapis.com/v1/otherContacts?readMask=names%2CemailAddresses%2CphoneNumbers&sources=READ_SOURCE_TYPE_PROFILE&pageSize=1000&alt=json returned "Must request READ_SOURCE_TYPE_CONTACT". Details: "Must request READ_SOURCE_TYPE_CONTACT">
What am I doing wrong?
Upvotes: 1
Views: 465
Reputation: 1
According to Google's documentation:
Specifying
READ_SOURCE_TYPE_PROFILE
without specifyingREAD_SOURCE_TYPE_CONTACT
is not permitted.
Setting both READ_SOURCE_TYPE_CONTACT
and READ_SOURCE_TYPE_PROFILE
should resolve this issue.
Upvotes: 0