Code Guy
Code Guy

Reputation: 3198

People API not creating birthday when date object is passed

I want to create a contact where I need to create entry in birthday calendar. Hence I am using people API to create a birthday date

I am following this documentation https://developers.google.com/people/api/rest/v1/people#Person.Birthday

Click here to open the API builder

personFields are set to

names,birthdays,phoneNumbers,memberships

I am passing the person object as

{
  "phoneNumbers": [
    {
      "type": "work",
      "value": "(266) 581-6706"
    }
  ],
  "names": [
    {
      "unstructuredName": "Bradley"
    }
  ],
  "birthdays": [
    {
      "date": {
        "year": 2012,
        "month": 10,
        "day": 13
      }
    }
  ],
  "memberships": [
    {
      "contactGroupMembership": {
        "contactGroupResourceName": "contactGroups/myContacts"
      }
    }
  ]
}

But the API does create a date with "text": "10/13/2021" which is of no use since this method will not create entries in birthday calendar. I am expecting the date object to be passed. Could anyone tell me, Whether I am missing something

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

Upvotes: 1

Views: 141

Answers (1)

ziganotschka
ziganotschka

Reputation: 26796

There is a new bug affecting the setting of birthdays

I suggest you to "star" it to increase visibility, so that it hopefully will be fixed faster.

Upvotes: 1

Related Questions