我知道您可以在設置頁面上獲取它。 我在一個帳戶上有多個日曆。如何從Google Calendar API獲取calendar_id
我能得到的名稱回來 service.list_calendar_lists(page_token:page_token)
,但我怎麼可以用日曆的名稱關聯的日曆IDS
我知道您可以在設置頁面上獲取它。 我在一個帳戶上有多個日曆。如何從Google Calendar API獲取calendar_id
我能得到的名稱回來 service.list_calendar_lists(page_token:page_token)
,但我怎麼可以用日曆的名稱關聯的日曆IDS
這是一個從service.list_calendar_lists
返回的結構一個JSON有一個條目items
items
是一個日曆列表項的數組,每個數組元素包括id
這就是你所要求的。
因此,像
array_of_ids = service.list_calendar_lists(page_token: page_token)['items']map{|i| i['id']}
您可以用GET請求使用CalendarList()如圖所示,谷歌日曆APIhere英寸我通過傳遞上面鏈接的文檔中所述的「主要」關鍵字來檢索我自己的日曆ID來測試這一點。