请求
| 基本信息 | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/v2/user/getbymobile |
| HTTP Method | POST |
| 支持的应用类型 | appType-企业内部应用 |
| 权限要求 | permission-qyapi_get_member_by_mobile-根据手机号获取成员基本信息权限 |
查询参数
| 名称 | 类型 | 是否必填 | 示例值 | 描述 |
|---|---|---|---|---|
| access_token | String | 是 | be3Fxxxx | 调用该接口的应用凭证,通过获取企业内部应用的access_token接口获取。 |
请求体
| 名称 | 类型 | 是否必填 | 示例值 | 描述 |
|---|---|---|---|---|
| mobile | String | 是 | 1*******543 | 用户的手机号。 |
请求示例
curl -X POST "https://api.dingtalk.io/topapi/v2/user/getbymobile" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=2015ca04-c84e-4855-9e52-330b98eb35f5' \
-d 'mobile=13800138000'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/v2/user/getbymobile");
OapiV2UserGetbymobileRequest req = new OapiV2UserGetbymobileRequest();
req.setMobile("1*******543");
OapiV2UserGetbymobileResponse rsp = client.execute(req, acces_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiV2UserGetbymobileRequest("https://api.dingtalk.io/topapi/v2/user/getbymobile")
req.mobile="13800138000"
req.support_exclusive_account_search=true
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 OapiV2UserGetbymobileRequest;
$req->setMobile("13800138000");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/v2/user/getbymobile");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/v2/user/getbymobile");
OapiV2UserGetbymobileRequest req = new OapiV2UserGetbymobileRequest();
req.Mobile = "13800138000";
OapiV2UserGetbymobileResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
响应
响应体
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| request_id | String | 5w82ciuur781 | 请求ID。 |
| errcode | Number | 0 | 返回码。 |
| errmsg | String | ok | 返回码描述。 |
| result | Object | 返回结果。 | |
| userid | String | zhangsan | 员工的userId。 |
响应体示例
{
"errcode":"0",
"result":{
"userid":"xiaoding"
},
"errmsg":"ok"
}
错误码
若调用该接口报错,可根据错误信息在全局错误码文档中查找解决方案。| 错误码(errcode) | 错误码描述(errmsg) | 解决方案 |
|---|---|---|
| 400002 | 无效的参数 | 请确认参数是否按照上述文档要求填写 |
| 40104 | 企业中无效的手机号 | 请检查手机号是否正确 |
| 60121 | 未找到该用户 | 请确认信息填写是否正确 |
| -1 | 系统繁忙 | 请稍后再试 |