查询主日历日程忙闲信息
调用该接口查询指定用户的主日历忙闲信息,或者查询指定会议室的忙闲信息。
Tip: 如果使用应用身份调用该接口,则需要确保应用开启了机器人能力。
请求
| 项目 | 值 |
|---|---|
| HTTP URL | https://open.feishu.cn/open-apis/calendar/v4/freebusy/list |
| HTTP Method | POST |
| 接口频率限制 | 1000 次/分钟、50 次/秒 |
| 支持的应用类型 | custom,isv |
| 权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用 开启任一权限即可 | calendar:calendar 更新日历及日程信息 calendar:calendar.free_busy:read 读取日历忙闲信息 calendar:calendar:readonly 获取日历、日程及忙闲信息 |
| 字段权限要求 | > Tip: 该接口返回体中存在下列敏感字段,仅当开启对应的权限后才会返回;如果无需获取这些字段,则不建议申请 contact:user.employee_id:readonly 获取用户 user ID |
请求头
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Authorization | string | 是 | tenant_access_token 或 user_access_token 值格式:"Bearer access_token" 示例值:"Bearer u-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token |
| Content-Type | string | 是 | 固定值:"application/json; charset=utf-8" |
查询参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
user_id_type | string | 否 | 用户 ID 类型 示例值:open_id 可选值有: - open_id: 标识一个用户在某个应用中的身份。同一个用户在不同应用中的 Open ID 不同。了解更多:如何获取 Open ID - union_id: 标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union ID,应用开发商可以把同个用户在多个应用中的身份关联起来。了解更多:如何获取 Union ID? - user_id: 标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID 主要用于在不同的应用间打通用户数据。了解更多:如何获取 User ID?默认值: open_id当值为 user_id,字段权限要求: contact:user.employee_id:readonly 获取用户 user ID |
请求体
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
time_min | string | 是 | 查询时段开始时间,RFC 3339 date_time 格式。 注意:time_min 与 time_max 之间的时间间隔不能大于 90 天。 示例值:"2020-10-28T12:00:00+08:00" |
time_max | string | 是 | 查询时段结束时间,RFC 3339 date_time 格式。 注意:time_min 与 time_max 之间的时间间隔不能大于 90 天。 示例值:"2020-12-28T12:00:00+08:00" |
user_id | string | 否 | 用户 ID,需要传入与查询参数 user_id_type 相匹配的 id。例如,user_id_type=open_id 时,需要传入用户的 open_id。了解用户 ID 参见用户相关的 ID 概念。注意:user_id 与 room_id 需要二选一传入,如果同时传入则只生效 user_id。 示例值:"ou_xxxxxxxxxx" |
room_id | string | 否 | 会议室 room_id。你可以调用查询会议室列表接口或者搜索会议室接口,获取相应会议室的 room_id。 注意:user_id 与 room_id 需要二选一传入,如果同时传入则只生效 user_id。 示例值:"omm_xxxxxxxxxx" |
include_external_calendar | boolean | 否 | 是否包含绑定的三方日历中的日程。 取值: - true(默认值):包含 - false:不包含 示例值:true |
only_busy | boolean | 否 | 是否只查询忙碌日程信息。 取值: - true(默认值):是,查询结果不包含空闲日程。 - false:否,查询结果包含空闲日程。 示例值:true |
need_rsvp_status | boolean | 否 | 是否需要RSVP状态信息 示例值:true |
请求体示例
json
{
"time_min": "2020-10-28T12:00:00+08:00",
"time_max": "2020-12-28T12:00:00+08:00",
"user_id": "ou_xxxxxxxxxx",
"room_id": "omm_xxxxxxxxxx",
"include_external_calendar": true,
"only_busy": true,
"need_rsvp_status": true
}响应
响应体
| 名称 | 类型 | 描述 |
|---|---|---|
code | int | 错误码,非 0 表示失败 |
msg | string | 错误描述 |
data | \- | - |
└ freebusy_list | freebusy\[\] | 在请求的时间区间内的忙碌时间段列表。 |
└ start_time | string | 忙闲信息开始时间,RFC 3339 date_time 格式。 |
└ end_time | string | 忙闲信息结束时间,RFC 3339 date_time 格式。 |
└ rsvp_status | string | 用户RSVP状态 可选值有: - needs_action: 参与人尚未回复状态,或表示会议室预约中 - accept: 参与人回复接受,或表示会议室预约成功 - tentative: 参与人回复待定 - decline: 参与人回复拒绝,或表示会议室预约失败 - removed: 参与人或会议室已经从日程中被移除 |
响应体示例
json
{
"code": 0,
"msg": "success",
"data": {
"freebusy_list": [
{
"start_time": "2020-10-28T22:30:00+08:00",
"end_time": "2020-10-28T22:45:00+08:00",
"rsvp_status": "needs_action"
}
]
}
}错误码
| HTTP状态码 | 错误码 | 描述 | 排查建议 |
|---|---|---|---|
| 400 | 190002 | invalid parameters in request | 无效的请求参数。排查建议如下: - 确认请求参数的字段名称、传参类型正确。 - 确认已经申请了相应资源的权限。 - 确认相应资源未被删除。 |
| 500 | 190003 | internal service error | 内部服务错误,请咨询技术支持。 |
| 429 | 190004 | method rate limited | 方法频率限制。建议稍后再试,并适当减小请求 QPS。 |
| 429 | 190005 | app rate limited | 应用频率限制。建议稍后再试,并适当减小请求 QPS。 |
| 403 | 190006 | wrong unit for app tenant | 请求错误,检查应用 App ID 和 App Secret 是否正确。如仍无法解决请咨询技术支持。 |
| 404 | 190007 | app bot_id not found | 应用的 bot_id 没有找到。你需要确保应用开启了机器人能力。如仍未解决请咨询技术支持。 |
| 429 | 190010 | current operation rate limited | 当前操作被限流,原因一般为公用资源并发抢占失败。你可以适当降低当前操作频率,然后重试。 |
| 400 | 190014 | invalid request parameters. check details for more info. | 无效的请求参数。请从details字段查看详细原因。 |
| 404 | 195100 | user is dismiss or not exist in the tenant | 当前身份或指定用户已经离职,或者不在该租户内。请检查并改为正确的身份来调用接口。 |
更多错误码信息,参见通用错误码。
