Google People API:收到无效的 JSON 有效负载(邮递员)
在 postman 中工作并尝试测试 Google People API,并遇到以下错误。
> "error": {
> "code": 400,
> "message": "Invalid JSON payload received. Unknown name \"personFields\": Cannot bind query parameter. Field 'personFields'
> could not be found in request message.",
> "status": "INVALID_ARGUMENT",
> "details": [
> {
> "@type": "type.googleapis.com/google.rpc.BadRequest",
> "fieldViolations": [
> {
> "description": "Invalid JSON payload received. Unknown name \"personFields\": Cannot bind query parameter. Field
> 'personFields' could not be found in request message."
> }
> ]
> }
> ] } }
这是我尝试运行的 GET 请求:
https://people.googleapis.com/v1/people:[email protected]&personFields=person.email_addresses
我已阅读 google People 文档,但不太明白我做错了什么。在文档中它提到我需要一个 personFields 查询参数,但它抛出了上面的错误。我认为我的格式在某种意义上是错误的,但我在网上找不到大量具体的例子。
有关更多上下文,我尝试搜索用户的通讯录并尝试查找电子邮件地址并返回相关信息。任何帮助将不胜感激。
Working and trying to test the Google People API in postman, and running into the following error.
> "error": {
> "code": 400,
> "message": "Invalid JSON payload received. Unknown name \"personFields\": Cannot bind query parameter. Field 'personFields'
> could not be found in request message.",
> "status": "INVALID_ARGUMENT",
> "details": [
> {
> "@type": "type.googleapis.com/google.rpc.BadRequest",
> "fieldViolations": [
> {
> "description": "Invalid JSON payload received. Unknown name \"personFields\": Cannot bind query parameter. Field
> 'personFields' could not be found in request message."
> }
> ]
> }
> ] } }
Here is the GET request I am trying to run:
https://people.googleapis.com/v1/people:[email protected]&personFields=person.email_addresses
I have read through the google People Docs but do not quite understand what I am doing wrong. In the docs it mentions I need a personFields query param, yet it is throwing the error above. I assume my formatting is wrong in some sense, but there aren't a ton of concrete examples I could find online.
For more context, I am attempting to search through the user's contact book and try and find the email address, and return pertinent information. Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想要搜索其他用户的通讯录,则需要使用以下端点:
作为 记录在此处这是用于实现您需要的内容的:
使用上面的内容,这是您在 Postman 中需要的 URL:
其中:
Me = 经过身份验证的用户。
PageSize = 可以是 1 到 1000 之间的任意数字
需要注意的是:
If what you are looking to do is search through another user's contact book instead you need to use the endpoint below:
As documented here this is the one to be used to achieve what you need:
Using the above this is the URL you will need in Postman:
Where:
Me = the authenticated user.
PageSize = can be any number from 1 to 1000
Something to note: