空き予定を検索する

目次

空き予定を検索する

ユーザー/組織/施設の空き時間を検索します。

  • 最大で 10 件の空き時間を取得できます。

URL

クラウド版

https://sample.cybozu.com/g/api/v1/schedule/searchAvailableTimes

パッケージ版

環境に合わせてそれぞれ以下を置き換えてください。

  • IP_ADDRESS_OR_HOST_NAME:Garoon のインストール先の IP アドレスまたはホスト名
  • INSTALL_IDENTIFER:Garoon のインストール識別子
Windows 環境
https://IP_ADDRESS_OR_HOST_NAME/scripts/INSTALL_IDENTIFER/grn.exe/api/v1/schedule/searchAvailableTimes
Linux 環境
https://IP_ADDRESS_OR_HOST_NAME/cgi-bin/INSTALL_IDENTIFER/grn.cgi/api/v1/schedule/searchAvailableTimes

HTTP メソッド

POST

利用できるバージョン

  • クラウド版 Garoon
  • パッケージ版 Garoon 5.0 以降

必要なアクセス権

  • 予定の追加権限

リクエスト

パラメーター
パラメーター名 必須 説明
timeRanges 配列 必須 時間範囲
timeRanges[].start 文字列 必須 時間の検索範囲(開始時間)
timeRanges[].end 文字列 必須 時間の検索範囲(終了時間)
timeInterval 数値 必須 空き予定の時間の間隔
1 から 1,439 まで指定できます。
たとえば、timeRanges[].start を 8 時、timeRanges[].end を 10 時に設定した場合、timeInterval に「60」を指定すると、次の時間帯で空き予定を取得できます。
  • 8 時〜9 時
  • 9 時〜 10 時
attendees 配列 条件必須 参加者の一覧
attendees または facilities が必須です。
attendees[].type 文字列 条件必須 参加者のタイプ
次のいずれかの値を指定します。
  • ORGANIZATION:組織
  • USER:ユーザー
attendees を指定する場合は必須です。
attendees[].id 文字列 条件必須 組織またはユーザー情報の ID
attendees[].type に指定する値ごとに異なります。
  • 「ORGANIZATION」 の場合:組織 ID
  • 「USER」 の場合:Garoon ユーザー ID
attendees を指定する場合、attendees[].id または attendees[].code が必須です。
attendees[].code 文字列 条件必須 組織またはユーザー情報のコード
attendees[].type に指定する値ごとに異なります。
  • 「ORGANIZATION」 の場合:組織コード
  • 「USER」 の場合:Garoon ユーザー名(ログイン名)
    パッケージ版 Garoon の場合、ログイン名を公開する設定が必要です。
    詳細は ユーザー情報の項目を変更する (External link) を参照してください。
attendees[].id または attendees[].code が必須です。
どちらも指定すると、attendees[].id の値が設定されます。
facilities 配列 条件必須 施設の一覧
attendees または facilities が必須です。
施設を更新するときは、すべての施設を指定してください。
空配列を指定すると、施設がすべて削除されます。
facilities[].id 文字列 条件必須 施設 ID
facilities を指定する場合、facilities[].id または facilities[].code が必須です。
facilities[].code 文字列 条件必須 施設コード
facilities を指定する場合、facilities[].id または facilities[].code が必須です。
両方を指定すると、facilities[].id の値が設定されます。
facilitySearchCondition 文字列 省略可 施設検索の条件
次のいずれかの値を指定します。
  • AND
  • OR
リクエストの例
ヘッダー
1
2
3
4
{
  "X-Cybozu-Authorization": "QWRtaW5pc3RyYXRvcjpjeWJvenU=",
  "Content-Type": "application/json"
}

リクエストヘッダーの詳細は Garoon REST APIの共通仕様 を参照してください。

ボディ
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
  "timeRanges": [
    {
      "start": "2018-01-01T09:00:00+09:00",
      "end": "2018-01-02T09:00:00+09:00"
    }
  ],
  "timeInterval": "60",
  "attendees": [
    {
      "id": "1",
      "type": "USER",
      "code": "c000001"
    }
  ],
  "facilities": [
    {
      "id": "5",
      "code": "roa"
    }
  ],
  "facilitySearchCondition": "OR"
}

レスポンス

プロパティ
プロパティ名 説明
availableTimes 配列 空き予定の候補
availableTimes[].start.dateTime 文字列 空き予定の開始日時
availableTimes[].start.timeZone 文字列 空き予定の開始日時のタイムゾーン
availableTimes[].end.dateTime 文字列 空き予定の終了日時
availableTimes[].end.timeZone 文字列 空き予定の終了日時のタイムゾーン
availableTimes[].facility.id 数値 組織 ID
availableTimes[].facility.code 文字列 組織コード
availableTimes[].facility.name 文字列 組織名
レスポンスの例
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{
  "availableTimes": [
    {
      "start": {
        "dateTime": "2018-08-08T00:00:00+09:00",
        "timeZone": "Asia/Tokyo"
      },
      "end": {
        "dateTime": "2018-08-08T01:00:00+09:00",
        "timeZone": "Asia/Tokyo"
      },
      "facility": {
        "id": "1",
        "code": "F001",
        "name": "28F conference room"
      }
    }
  ]
}

サンプルコード

curl を使ったリクエスト
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
curl -X POST 'https://sample.cybozu.com/g/api/v1/schedule/searchAvailableTimes' \
  -H 'X-Cybozu-Authorization: QWRtaW5pc3RyYXRvcjpjeWJvenU=' \
  -H 'Content-Type: application/json' \
  -d '{
    "timeRanges": [
      {
        "start": "2020-06-09T09:00:00+09:00",
        "end": "2020-06-09T10:00:00+09:00"
      }
    ],
    "timeInterval": "60",
    "facilities": [
      {
        "code": "SeminarA"
      }
    ]
  }'
Garoon REST API リクエストを送信する API を使ったリクエスト
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
const body = {
  timeRanges: [
    {
      start: '2020-06-09T09:00:00+09:00',
      end: '2020-06-09T10:00:00+09:00'
    }
  ],
  timeInterval: 60,
  facilities: [
    {
      code: 'SeminarA'
    }
  ]
};

await garoon.api('/api/v1/schedule/searchAvailableTimes', 'POST', body);