I have used the the calendar api https://www.googleapis.com/calendar/v3/calendars/ for creating an event but not getting meeting link. Also i have tested the api in postman but getting bad request attaching the body
resource:{conferenceData:{createRequest:{requestId:7qxalsvy02}}}
conferenceDataVersion: 1
summary: demo14
start: { dateTime: 14/10/2020, timeZone: UTC}
end: { dateTime: 14/10/2020, timeZone: UTC}
attendees: [{email: [email protected], self: True}]
description:des
Attaching code
bearer = 'Bearer '+login_user_id.access_token
payload = {}
headers = {
'Content-Type': "application/json",
'Authorization':bearer
}
attendees_list = []
attendees = self.sudo().partner_ids
for i in attendees:
attendees_list.append({"email" :i.email})
resource={"conferenceData":{"createRequest":{"requestId": "7qxalsvy02"}}}
body={
"resource": resource,
"conferenceDataVersion": 1,
"summary" : self.name,
"start": { "dateTime": start_datetime, "timeZone": "UTC"},
"end": { "dateTime": end_datetime, "timeZone": "UTC"},
"attendees":attendees_list,
"description":self.description,
}
data_json = json.dumps(body)
url='https://www.googleapis.com/calendar/v3/calendars/'+login_user_id.calendar_id+'/events'
hangout_meet_response = requests.request("POST", url, headers=headers, data=data_json)
if hangout_meet_response.status_code == 200:
data_rec = hangout_meet_response.json()
self.write({"meet_url":data_rec.get('hangoutLink'),"meet_id":data_rec.get('id')})
hangout_meet_link = data_rec.get('hangoutLink')
if hangout_meet_link:
self.write({"meet_code": hangout_meet_link.split('/')[3]})
elif hangout_meet_response.status_code == 401:
raise UserError("Please Authenticate with Hangouts Meet.")
conferenceDataVersion
is not a part of the request body, it needs to be incorporated into the request URL: