【发布时间】:2021-10-03 20:45:39
【问题描述】:
在 Google People - people.connections.list 和其他 GET API 中,某些联系人不返回生日字段的日期对象。已使用完整的人员范围进行身份验证 [https://www.googleapis.com/auth/contacts]。
我们也不知道要解析的“文本”字段的格式,因为参数可以有任何随机字符串。
如何解析用户的生日?什么时候不返回 Date 对象?
样品申请
生日示例回复
{
"birthdays": [
{
"metadata": {
"source": {
"id": "3ebd95668aeed9d7",
"type": "CONTACT"
},
"primary": true
},
"text": "2000-07-24"
}
],
"resourceName": "people/c4520933868599957975",
"etag": "<etag>"
},
{
"birthdays": [
{
"metadata": {
"source": {
"id": "5f5712ce0861c5b0",
"type": "CONTACT"
},
"primary": true
},
"text": "1880-03-11"
}
],
"resourceName": "people/c6869980432690169264",
"etag": "<etag>"
},
{
"birthdays": [
{
"date": {
"month": 1,
"year": 1990,
"day": 26
},
"metadata": {
"source": {
"id": "a16dde58e814a36",
"type": "CONTACT"
},
"primary": true
},
"text": "01/26/1990"
}
],
"resourceName": "people/c727012367875000886",
"etag": "<etag>"
},
{
"birthdays": [
{
"date": {
"month": 1,
"year": 1998,
"day": 1
},
"metadata": {
"source": {
"id": "f350f568dd11db1",
"type": "CONTACT"
},
"primary": true
},
"text": "Jan 1, 1998"
}
],
"resourceName": "people/c1095798948755479985",
"etag": "<etag>"
},
{
"birthdays": [
{
"metadata": {
"source": {
"id": "3652e00f0d28c9f4",
"type": "CONTACT"
},
"primary": true
},
"text": "random string accept"
}
],
"resourceName": "people/c3914437381388290548",
"etag": "<etag>"
}
]
【问题讨论】:
-
你好,你能把你正在使用的范围包括进来吗?
-
使用完整范围 - googleapis.com/auth/contacts。我会把它添加到问题中