根据 Google 日历 ID 返回活动。若要使用 iCalendar ID 检索活动,请使用 iCalUID
参数调用 events.list 方法。
立即试用或查看示例。
请求
HTTP 请求
GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId
参数
参数名称 | 值 | 说明 |
---|---|---|
路径参数 | ||
calendarId |
string |
日历标识符。要检索日历 ID,请调用 calendarList.list 方法。如果您想访问当前登录的用户的主日历,请使用“primary ”关键字。
|
eventId |
string |
事件标识符。 |
可选的查询参数 | ||
alwaysIncludeEmail |
boolean |
已弃用并忽略。系统将始终在 email 字段中为组织者、创建者和参加者返回一个值,即使没有可用的实际电子邮件地址(即,将提供生成的非工作值)。
|
maxAttendees |
integer |
回复中包含的参加者人数上限。如果参与者人数超过指定数量,则只返回参与者。可选。 |
timeZone |
string |
响应中使用的时区。(可选)默认值为日历的时区。 |
授权
此请求至少授予以下其中一个范围的授权:
范围 |
---|
https://www.googleapis.com/auth/calendar.readonly |
https://www.googleapis.com/auth/calendar |
https://www.googleapis.com/auth/calendar.events.readonly |
https://www.googleapis.com/auth/calendar.events |
如需了解详情,请参阅身份验证和授权页面。
请求正文
使用此方法时请勿提供请求正文。
响应
如果成功,此方法将在响应正文中返回 Events 资源。
示例
注意:此方法的代码示例并未列出所有受支持的编程语言(请参阅客户端库页面,查看受支持的语言列表)。
Java
使用 Java 客户端库。
import com.google.api.services.calendar.Calendar; import com.google.api.services.calendar.model.Event; // ... // Initialize Calendar service with valid OAuth credentials Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials) .setApplicationName("applicationName").build(); // Retrieve an event Event event = service.events().get('primary', "eventId").execute(); System.out.println(event.getSummary());
Python
使用 Python 客户端库。
event = service.events().get(calendarId='primary', eventId='eventId').execute() print event['summary']
PHP
使用 PHP 客户端库。
$event = $service->events->get('primary', "eventId"); echo $event->getSummary();
Ruby
使用 Ruby 客户端库。
result = client.get_event('primary', 'eventId') print result.summary
试试看!
请使用下面的 API Explorer 针对实际数据调用此方法,然后查看响应。