CalendarList: get

แสดงผลปฏิทินจากรายการปฏิทินของผู้ใช้ ลองใช้เลยหรือดูตัวอย่าง

ส่งคำขอ

คำขอ HTTP

GET https://www.googleapis.com/calendar/v3/users/me/calendarList/calendarId

พารามิเตอร์

ชื่อพารามิเตอร์ ค่า คำอธิบาย
พารามิเตอร์เส้นทาง
calendarId string ตัวระบุปฏิทิน หากต้องการเรียกข้อมูลรหัสปฏิทิน ให้เรียกเมธอด calendarList.list หากต้องการเข้าถึงปฏิทินหลักของผู้ใช้ที่เข้าสู่ระบบในปัจจุบัน ให้ใช้คีย์เวิร์ด "primary"

การให้สิทธิ์

คำขอนี้ต้องได้รับสิทธิ์จากขอบเขตต่อไปนี้อย่างน้อย 1 ขอบเขต

ขอบเขต
https://www.googleapis.com/auth/calendar.readonly
https://www.googleapis.com/auth/calendar

โปรดดูข้อมูลเพิ่มเติมที่หน้าการตรวจสอบสิทธิ์และการให้สิทธิ์

เนื้อหาของคำขอ

โปรดอย่าแสดงเนื้อหาของคำขอด้วยวิธีนี้

คำตอบ

หากสำเร็จ เมธอดนี้จะแสดงผลทรัพยากร CalendarList ในเนื้อหาการตอบกลับ

ตัวอย่าง

หมายเหตุ: ตัวอย่างโค้ดที่มีสำหรับวิธีการนี้ไม่ได้แสดงถึงภาษาโปรแกรมที่รองรับทั้งหมด (ดูรายการภาษาที่รองรับได้ในหน้าไลบรารีของไคลเอ็นต์)

Java

ใช้ไลบรารีของไคลเอ็นต์ Java

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

// ...

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

// Retrieve a specific calendar list entry
CalendarListEntry calendarListEntry = service.calendarList().get("calendarId").execute();

System.out.println(calendarListEntry.getSummary());

Python

ใช้ไลบรารีของไคลเอ็นต์ Python

calendar_list_entry = service.calendarList().get(calendarId='calendarId').execute()

print(calendar_list_entry['summary'])

PHP

ใช้ไลบรารีของไคลเอ็นต์ PHP

$calendarListEntry = $service->calendarList->get('calendarId');

echo $calendarListEntry->getSummary();

Ruby

ใช้ไลบรารีของไคลเอ็นต์ Ruby

result = client.get_calendar_list('calendarId')
print result.summary

ลองใช้เลย

ใช้ API Explorer ด้านล่างเพื่อเรียกใช้เมธอดนี้กับข้อมูลแบบเรียลไทม์และดูการตอบสนอง