【发布时间】:2021-11-15 14:37:02
【问题描述】:
我想创建一个联系人,我需要在生日日历中创建条目。因此我使用 people API 来创建生日日期
我正在关注此文档https://developers.google.com/people/api/rest/v1/people#Person.Birthday
Click here to open the API builder
personFields 设置为
names,birthdays,phoneNumbers,memberships
我将 person 对象传递为
{
"phoneNumbers": [
{
"type": "work",
"value": "(266) 581-6706"
}
],
"names": [
{
"unstructuredName": "Bradley"
}
],
"birthdays": [
{
"date": {
"year": 2012,
"month": 10,
"day": 13
}
}
],
"memberships": [
{
"contactGroupMembership": {
"contactGroupResourceName": "contactGroups/myContacts"
}
}
]
}
但是 API 确实使用"text": "10/13/2021" 创建了一个日期,这是没有用的,因为此方法不会在生日日历中创建条目。我期待通过日期对象。谁能告诉我,我是否遗漏了什么
curl --request POST \
'https://people.googleapis.com/v1/people:createContact?personFields=names%2Cbirthdays%2CphoneNumbers%2Cmemberships&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"phoneNumbers":[{"type":"work","value":"(266) 581-6706"}],"names":[{"unstructuredName":"Bradley"}],"birthdays":[{"date":{"year":2012,"month":10,"day":13}}],"memberships":[{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/myContacts"}}]}' \
--compressed
【问题讨论】: