第三方应用开发 服务端API 日程 管理日程 创建日程
创建日程
最后更新:2023/06/20
可联系渠道经理采购或代理智慧硬件接口已支持设备 联系渠道经理
创建日程
最后更新:2023/06/20

该接口用于在日历中创建一个日程。

请求方式: POST(HTTPS
请求地址: https://qyapi.weixin.qq.com/cgi-bin/oa/schedule/add?access_token=ACCESS_TOKEN

请求包体:

{
	"schedule": {
		"admins":[
				"admin1",
				"admin2"
		],
		"start_time": 1571274600,
		"end_time": 1571320210,
		"is_whole_day":1,
		"attendees": [{
			"userid": "userid2"
		}],
		"summary": "需求评审会议",
		"description": "2.0版本需求初步评审",
		"reminders": {
			"is_remind": 1,
			"remind_before_event_secs": 3600,
			"remind_time_diffs":[0, 3600],
			"is_repeat": 1,
			"repeat_type": 7,
			"repeat_until": 1606976813,
			"is_custom_repeat": 1,
			"repeat_interval": 1,
			"repeat_day_of_week": [3, 7],
			"repeat_day_of_month": [10, 21],
			"timezone": 8
		},
		"location": "广州国际媒体港10楼1005会议室",
		"cal_id": "wcjgewCwAAqeJcPI1d8Pwbjt7nttzAAA"
	},
	"agentid": 1000014
}

参数说明:

 

参数必须类型说明
access_tokenstring调用接口凭证
scheduleobj日程信息
schedule.adminsstring日程的管理员userid列表,管理员必须在共享成员的列表中。最多指定3人
schedule.attendeesobj[]日程参与者列表。最多支持1000人
schedule.attendees.useridstring日程参与者ID
不多于64字节
schedule.summarystring日程标题。0 ~ 128 字符。不填会默认显示为“新建事件”
schedule.descriptionstring日程描述
不多于1000个字符
schedule.remindersobj提醒相关信息
schedule.reminders.is_remindint32是否需要提醒。0-否;1-是
schedule.reminders.is_repeatint32是否重复日程。0-否;1-是
schedule.reminders.remind_before_event_secsuint32日程开始(start_time)前多少秒提醒,当is_remind为1时有效。
例如: 300表示日程开始前5分钟提醒。目前仅支持以下数值:
0 - 事件开始时
300 - 事件开始前5分钟
900 - 事件开始前15分钟
3600 - 事件开始前1小时
86400 - 事件开始前1天
schedule.reminders.remind_time_diffsint32[]提醒时间与日程开始时间(start_time)的差值,当is_remind为1时有效,可以指定多个提醒时间,目前仅支持以下数值:
0 - 事件开始时
-300 - 事件开始前5分钟
-900 - 事件开始前15分钟
-3600 - 事件开始前1小时
-86400 - 事件开始前1天
当is_whole_day=1时,还支持:
32400 - 事件开始当天(09:00)
-172800 - 事件开始前两天
-604800 - 事件开始前1周
该字段与remind_before_event_secs仅一个字段会生效,当该字段有传值且列表不为空时,优先以该字段为准
schedule.reminders.repeat_typeuint32重复类型,当is_repeat为1时有效。目前支持如下类型:
0 - 每日
1 - 每周
2 - 每月
5 - 每年
7 - 工作日
schedule.reminders.repeat_untiluint32重复结束时刻,Unix时间戳,当is_repeat为1时有效。不填或填0表示一直重复
schedule.reminders.is_custom_repeatuint32是否自定义重复。0-否;1-是。当is_repeat为1时有效。
schedule.reminders.repeat_intervaluint32重复间隔
仅当指定为自定义重复时有效
该字段随repeat_type不同而含义不同
例如:
repeat_interval指定为3,repeat_type指定为每周重复,那么每3周重复一次;
repeat_interval指定为3,repeat_type指定为每月重复,那么每3个月重复一次
schedule.reminders.repeat_day_of_weekuint32[]每周周几重复
仅当指定为自定义重复且重复类型为每周时有效
取值范围:1 ~ 7,分别表示周一至周日
schedule.reminders.repeat_day_of_monthuint32[]每月哪几天重复
仅当指定为自定义重复且重复类型为每月时有效
取值范围:1 ~ 31,分别表示1~31号
schedule.reminders.timezoneuint32时区。UTC偏移量表示(即偏离零时区的小时数),东区为正数,西区为负数。
例如:+8 表示北京时间东八区
默认为北京时间东八区
取值范围:-12 ~ +12
schedule.locationstring日程地址
不多于128个字符
schedule.start_timeuint32日程开始时间,Unix时间戳
schedule.end_timeuint32日程结束时间,Unix时间戳
schedule.cal_idstring日程所属日历ID。该日历必须是access_token所对应应用所创建的日历。如果不填,那么插入到access_token所对应应用的默认日历上。
第三方应用必须指定cal_id
不多于64字节
schedule.is_whole_dayuint32是否设置为全天日程。0-否;1-是
agentiduint32授权方安装的应用agentid。仅旧的第三方多应用套件需要填此参数

 

关于自定义重复的说明:
is_custom_repeat 如果为0,那么系统会根据 start_time 和 repeat_type 来自动计算下一次重复的时间,例如:

start_time 为本周周三8点整,repeat_type 为每周重复,那么每周三8点整重复;
start_time 为本月3号10点整,repeat_type 为每月重复,那么每月3号10点整重复;

如果 is_custom_repeat 指定为1,那么可以配合 repeat_day_of_week 或 repeat_day_of_month 特别指定周几或几号重复,且可以使用 repeat_interval 指定重复间隔


返回结果:

{ 
	"errcode": 0,
	"errmsg" : "ok",
	"schedule_id":"17c7d2bd9f20d652840f72f59e796AAA"
}

参数说明:

参数类型说明
errcodeint32返回码
errmsgstring错误码描述
schedule_idstring日程ID
上一篇
删除日历
下一篇
更新日程