Calendar API - events - endTimeUnspecified causing 403 error

已查看 88 次
跳至第一个未读帖子

Ján Tovarňák

未读,
2013年9月9日 11:22:132013/9/9
收件人 google-api...@googlegroups.com
Recently I moved from CalDAV synchronization to Calendar API v3 sync on my app running on Apache. With some patches to php client I got it working but I am still having troubles with one thing (well, one thing I know of so far) - I am allowing users to set events in deadline-like basis, which means the event has only one date specified (no end set). So I set endTimeUnspecified to true and tried insterting/updating an event with no end set (end variable was null - as seen on case #1). It showed me error 403 forbidden. Then I tried setting an end to empty Google_Date object (both date and dateTime being null - case #2), but it resulted to same error. Then I found in documentation that for legacy purposes google returns end specified even when endTimeUnspecified is true, so I set end time to start+some offset, keeping endTimeUnspecified on true (case #3), but I am still getting 403 error.
Is there any way to set endTimeUnspecified to true and get a successful response when saving?


case #1:
        $event->setStart($start);
        if(isset($end)){
            $event->setEnd($end);
        } else {
            $event->setEndTimeUnspecified(true);
        }

case #2:
        $event->setStart($start);
        if(isset($end)){
            $event->setEnd($end);
        } else {
            $end = new Google_EventDateTime();
            $event->setEndTimeUnspecified(true);
            $event->setEnd($end);
        }

case #3:
        $event->setStart($start);
        if(isset($end)){
            $event->setEnd($end);
        } else {
            $end = new Google_EventDateTime();
            if($task["all_day"]){
                $uEnd = DateTime::createFromFormat(MYSQL_DATEFORMAT,$task["start"])->modify("+1 day");
                $end->setDate($uEnd->format(MYSQL_DATEFORMAT));
            } else {
                $uEnd = DateTime::createFromFormat(MYSQL_DATETIMEFORMAT,$task["start"])->modify("+1 day");
                $end->setDateTime($uEnd->format(DateTime::RFC3339));
            }
            $event->setEndTimeUnspecified(true);
            $event->setEnd($end);
        }
回复全部
回复作者
转发
0 个新帖子