0
1

[Google Calendar API(V3)] Javaでカレンダーのメタデータを取得する

Posted at

Google Calendar API V3(Java)を使用して、
Googleカレンダーのメタデータを取得する方法
についてご紹介します。

APIを利用する環境の準備から始める場合や、コードを実行する際は、
⧉[Google Calendar API(V3)] JavaでCalendar APIを使う
を参照ください。

No 目次
1 メタデータを取得
1 スコープ
2 実行
3 レスポンスの内容

1. メタデータを取得

Googleカレンダーメタデータを取得します。

1.1. スコープ

このAPIを実行するには、以下のいずれかのスコープを指定してください。

CalendarScopes.CALENDAR
CalendarScopes.CALENDAR_READONLY

⧉[Google Calendar API(V3)] JavaでCalendar APIを使う(2.2 Driveインスタンスを取得)
でスコープを指定してください。

1.2. 実行

public static void main(String[] args) throws Exception{
    Calendar calendar = getCalendar();
    
    Calendar.Calendars calendars = calendar.calendars();
    Calendar.Calendars.Get get = calendars.get("カレンダーID");
    
    com.google.api.services.calendar.model.Calendar res = get.execute();
    System.out.println(res);
}

1.2.1. HTTPリクエスト

GET: https://www.googleapis.com/calendar/v3/calendars/{カレンダーID}
が実行されます。

1.2.2. クエリパラメータ

クエリパラメータはありません。

1.3. レスポンスの内容

Calendar

(com.google.api.services.calendar.model)

メソッド 戻り値 説明
getId String カレンダーID
getEtag String Eタグ
getKind String リソースの種類
固定文字列:"calendar#calendar"
getConferenceProperties ConferenceProperties 会議タイプ
getDescription String 説明
getLocation String カレンダーの地域
getSummary String 名前
getTimeZone String タイムゾーン

ConferenceProperties

メソッド 戻り値 説明
getAllowedConferenceSolutionTypes List<String> サポートされている会議タイプ
"eventHangout"、"eventNamedHangout"、"hangoutsMeet"


おしまい。。
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1