Deskripsi panggilan API
- Panggil API setelah pukul 09.00 untuk mendapatkan data hari sebelumnya.
- API ini hanya mengembalikan daftar karyawan yang tidak masuk ke DingTalk dalam satu bulan terakhir.
Permintaan
| Informasi dasar | |
|---|---|
| URL HTTP | https://api.dingtalk.io/topapi/inactive/user/v2/get |
| Metode HTTP | POST |
| Tipe aplikasi yang didukung | appType-Aplikasi internal |
| Izin yang diperlukan | permission-qyapi_liveness_base-Izin untuk mengakses data aktivitas organisasi |
Parameter kueri
| Nama | Tipe | Wajib | Contoh | Deskripsi |
|---|---|---|---|---|
| access_token | String | Ya | 6d1bxxxx | Kredensial aplikasi yang digunakan untuk memanggil API ini. Dapatkan dengan memanggil API untuk mendapatkan access_token aplikasi internal. |
Isi permintaan
| Nama | Tipe | Wajib | Contoh | Deskripsi |
|---|---|---|---|---|
| is_active | Boolean | Ya | false | Apakah pengguna aktif: - false: Tidak masuk - true: Masuk |
| dept_ids | String | Tidak | 1,2,3 | Daftar ID departemen. Dapatkan dengan memanggil Mendapatkan daftar departemen. Jika dikosongkan, seluruh organisasi akan dikueri. |
| offset | Number | Ya | 1 | Mendukung penomoran halaman. Hanya berlaku jika diatur bersama parameter size. Parameter ini menunjukkan offset, dimulai dari 0. |
| size | Number | Ya | 100 | Mendukung penomoran halaman. Hanya berlaku jika diatur bersama parameter offset. Parameter ini menunjukkan ukuran halaman. Nilai maksimum adalah 100. |
| query_date | String | Ya | 20200101 | Tanggal kueri. Formatnya adalah yyyyMMdd. |
Contoh permintaan
curl -X POST "https://api.dingtalk.io/topapi/inactive/user/v2/get" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=2146ca78-23af-4580-9335-883348ff9a54' \
-d 'dept_ids=%5C%222%2C3%2C4%5C%22' \
-d 'is_active=false' \
-d 'offset=0' \
-d 'query_date=20200101' \
-d 'size=100'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/inactive/user/v2/get");
OapiInactiveUserV2GetRequest req = new OapiInactiveUserV2GetRequest();
req.setIsActive(false);
req.setDeptIds("1,2,3");
req.setOffset(0L);
req.setSize(100L);
req.setQueryDate("20200101");
OapiInactiveUserV2GetResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiInactiveUserV2GetRequest("https://api.dingtalk.io/topapi/inactive/user/v2/get")
req.is_active=false
req.dept_ids=""2,3,4""
req.offset=0
req.size=100
req.query_date="20200101"
try:
resp= req.getResponse(access_token)
print(resp)
except Exception,e:
print(e)
include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');
$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
$req = new OapiInactiveUserV2GetRequest;
$req->setIsActive("false");
$req->setDeptIds("\"2,3,4\"");
$req->setOffset("0");
$req->setSize("100");
$req->setQueryDate("20200101");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/inactive/user/v2/get");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/inactive/user/v2/get");
OapiInactiveUserV2GetRequest req = new OapiInactiveUserV2GetRequest();
req.IsActive = false;
req.DeptIds = "\"2,3,4\"";
req.Offset = 0L;
req.Size = 100L;
req.QueryDate = "20200101";
OapiInactiveUserV2GetResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Respons
Isi respons
| Nama | Tipe | Contoh | Deskripsi |
|---|---|---|---|
| result | PageVo | Hasil yang dikembalikan. | |
| next_cursor | Number | 1000 | Offset halaman berikutnya. |
| list | String[] | [“user123”,“user456”] | Daftar pengguna yang tidak masuk. |
| has_more | Boolean | false | Apakah tersedia data lainnya. |
| errmsg | String | ok | Deskripsi kode pengembalian. |
| errcode | Number | 0 | Kode pengembalian. |
| request_id | String | o565d47xy9cz | ID permintaan. |
Contoh isi respons
{
"errcode": 0,
"result": {
"has_more": false,
"list": [
"011250026469774889",
"0260470242730556"
]
},
"request_id": "o565d47xy9cz"
}
Kode error
Jika terjadi error saat memanggil API ini, lihat dokumen Kode error global untuk menemukan solusi berdasarkan pesan error.| Kode error (errcode) | Pesan error (errmsg) | Solusi |
|---|---|---|
| 400002 | Invalid parameter | Periksa apakah parameter wajib memenuhi persyaratan. |
| 40069 | Invalid size | Periksa ukuran halaman. |
| 40068 | Invalid offset | Sesuaikan offset. |
| 400002 | Invalid parameter format | Periksa format parameter input. |
| -1 | System busy | Coba lagi nanti. |