谷歌日历API导致HTTP错误500


Google Calendar API causing HTTP Error 500

我正在使用新的Google Calendar API v3。我试图使用PHP库获取用户日历列表。如果我直接使用CURL发出请求,那么它可以正常工作,但是由于某些原因,当我尝试使用PHP库时,它失败并抛出500错误。以下是(缩写)代码:

 $this->calendarAPI = new apiCalendarService($this->client);
 $calendar_list = $this->calendarAPI->calendarList->list();

如果我var_dump $this->calendarAPI->calendarList的内容,那么我得到一个我所期望的对象。只有当我调用list方法时,一切才会出错。

谁能帮助我或我将不得不写我自己的库和与API协议直接交互?

好的,原来这是文档中的一个错误。而不是调用一个名为list()的方法,你必须调用listCalendarList()所以第二行应该是:

 $calendar_list = $this->calendarAPI->calendarList->listCalendarList();