zoom api cmeeting created with wrong start date

279 views Asked by At

I'm working on an elearning website and I'm trying to integrate Zoom meetings using the API

According to the official documentation, the start_time must be set to the yyyy-MM-ddTH:M:S.

Example : 2020-10-02T18:00:00

Based on that, this is the code I'm using.

class Zoom:

    ...

    def parse_date(self, date):
        parts = date.strip().split(' ')
        part1 = parts[0]
        part2 = parts[1]
        parts1 = part1.split('/')
        day = parts1[0]
        month = parts1[1]
        year = parts1[2]
        parts2 = part2.split(':')
        h = parts2[0]
        m = parts2[1]
        formatted_date = year + '-' + month + '-' + day + 'T' + h + ':' + m + ':00Z'
        return formatted_date

    def create_meeting(self, topic, start_date, password):
        token = self.get_token()
        conn = http.HTTPSConnection(Zoom.ZOOM_API_URL)      
        headers = {'authorization': "Bearer " + token, 'content-type': "application/json"}
        data = {'topic': topic, 'type': 2, 'start_time': self.parse_date(start_date), 'timezone': 'Africa/Casablanca', 'password': password}
        conn.request("POST", "/v2/users/me/meetings", json.dumps(data), headers)
        response = json.loads(conn.getresponse().read().decode('utf-8'))
        return response

zoom = Zoom('API_KEY', 'API_SECRET')
meeting = zoom.create_meeting(topic='Learning test', start_date='02/10/2020 18:00', password='123456')

The meeting is created but the start date is ignored as shown in the image

enter image description here

As you can see I specified 6 PM as a start date but it's 7 PM.

1

There are 1 answers

0
Amine Messaoudi On BEST ANSWER

It seems the problem was caused by the Z at the end of the date. After removing it the date hour is no longer incremented.