Acl: get

返回访问权限控制规则。 立即试用查看示例

请求

HTTP 请求

GET https://www.googleapis.com/calendar/v3/calendars/calendarId/acl/ruleId

参数

参数名称 说明
路径参数
calendarId string 日历标识符。要检索日历 ID,请调用 calendarList.list 方法。如果您想访问当前登录的用户的主日历,请使用关键字“primary”。
ruleId string ACL 规则标识符。

授权

此请求需要获得以下至少一个范围的授权:

范围
https://www.googleapis.com/auth/calendar.readonly
https://www.googleapis.com/auth/calendar

如需了解详情,请参阅身份验证和授权页面。

请求正文

使用此方法时请勿提供请求正文。

响应

如果成功,此方法将在响应正文中返回 Acl 资源

示例

注意:此方法的代码示例并未列出所有受支持的编程语言(请参阅客户端库页面,查看受支持的语言列表)。

Java

使用 Java 客户端库

import com.google.api.services.calendar.Calendar;
import com.google.api.services.calendar.model.AclRule;

// ...

// Initialize Calendar service with valid OAuth credentials
Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials)
    .setApplicationName("applicationName").build();

// Retrieve access rule
AclRule rule = service.acl().get('primary', "ruleId").execute();

System.out.println(rule.getId() + ": " + rule.getRole());

Python

使用 Python 客户端库

rule = service.acl().get(calendarId='primary', ruleId='ruleId').execute()

print '%s: %s' % (rule['id'], rule['role'])

PHP

使用 PHP 客户端库

$rule = $service->acl->get('primary', 'ruleId');

echo $rule->getId() . ': ' . $rule->getRole();

Ruby

使用 Ruby 客户端库

result = client.get_acl('primary', 'ruleId')
print result.id + ": " + result.role

试试看!

请使用下面的 API Explorer 对实时数据调用此方法并查看响应。