Dingtalk 日程

Dingtalk 日程

accessToken

1
2
3
4
5
6
7
https://api.dingtalk.com/v1.0/oauth2/accessToken

{
"appKey":"dingeesl8dcs9sbchsvc",
"appSecret":"y3S-J2o59z8oTHXfsfErQLNsSrpDr853v_E_r246ny3dSXwY14_5zW4PpeE91Hn9"
}

1
2
3
4
{
"expireIn":7200,
"accessToken":"2b5ad4889eb83c1090ecdd5d76ee9c0c"
}
1
2

052751293332180533

获取unionid

1
2
3
4
5
6
7
8
9
10
11
POST /topapi/v2/user/get?access_token=2b5ad4889eb83c1090ecdd5d76ee9c0c HTTP/2
Host: oapi.dingtalk.com
User-Agent: curl/7.84.0
Accept: */*
Content-Length: 72
Content-Type: application/json

{
"language":"zh_CN",
"userid":"052751293332180533"
}
1
2
3
4
5
6
7
8
HTTP/2 200 OK
Server: Tengine
Date: Sun, 09 Oct 2022 02:26:24 GMT
Content-Type: application/json;charset=UTF-8
Application-Host: 33.79.187.24
Cache-Control: no-cache

{"errcode":0,"errmsg":"ok","result":{"active":true,"admin":true,"avatar":"https:\/\/static-legacy.dingtalk.com\/media\/lADPDgtY2jyKVwEcHA_28_28.jpg","boss":false,"dept_id_list":[1],"dept_order_list":[{"dept_id":1,"order":68008674585631472}],"exclusive_account":false,"hide_mobile":false,"leader_in_dept":[{"dept_id":1,"leader":false}],"mobile":"18728463722","name":"罗智高","real_authed":false,"role_list":[{"group_name":"默认","id":224259376,"name":"主管理员"}],"senior":false,"state_code":"86","unionid":"8JxE92E401M6EWiiiPiSSusDAiEiE","userid":"052751293332180533"},"request_id":"16m8wsmgtxnck"}

查询日历

1
2
3
4
GET /v1.0/calendar/users/8JxE92E401M6EWiiiPiSSusDAiEiE/calendars HTTP/1.1
Host:api.dingtalk.com
x-acs-dingtalk-access-token:2b5ad4889eb83c1090ecdd5d76ee9c0c
Content-Type:application/json
1
2
3
4
5
6
7
8
9
10
HTTP/2 200 OK
Server: Tengine
Date: Sun, 09 Oct 2022 02:29:19 GMT
Content-Type: application/json
Content-Length: 193
Access-Control-Allow-Origin: *
X-Acs-Request-Id: 00712066-C6CC-713B-967C-F4B72CA71CCB
X-Acs-Trace-Id: f4e46095ad484ead3833570cb69ba178

{"requestId":"00712066-C6CC-713B-967C-F4B72CA71CCB","response":{"calendars":[{"eTag":"1665281303991","id":"primary","privilege":"owner","summary":"我的日历(钉钉)","type":"primary"}]}}

添加日程

1
2
3
4
5
6
7
POST /v1.0/calendar/users/8JxE92E401M6EWiiiPiSSusDAiEiE/calendars/primary/events HTTP/2
Host: api.dingtalk.com
X-Acs-Dingtalk-Access-Token: 2b5ad4889eb83c1090ecdd5d76ee9c0c
Content-Type: application/json
Content-Length: 235

{"summary":"today-test2","start":{"dateTime":"2022-10-09T11:15:30+08:00","timeZone":"Asia/Shanghai"},"reminders":[{"method":"sms","minutes":10}],"end":{"dateTime":"2022-10-09T12:15:30+08:00","timeZone":"Asia/Shanghai"},"isAllDay":false}