Request
| Basic information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/extcontact/delete |
| HTTP Method | POST |
| Supported app types | appType-Internal app |
| Required permissions | permission-qyapi_ext_write-Write permission for external contacts of the organization |
Query parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | 6d1bxxxx | The app credential used to call this API. Obtain it through the API for getting the access_token of an internal app. |
Request body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| user_id | String | Yes | 0125xxxx0251487 | The userId of the external contact to delete. Call the Get the list of external contacts API to obtain the value of the userid parameter. |
Request example
curl -X POST "https://api.dingtalk.io/topapi/extcontact/delete" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=22c945xxxx509f1' \
-d 'user_id=0125xxxx0251487'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/extcontact/delete");
OapiExtcontactDeleteRequest req = new OapiExtcontactDeleteRequest();
req.setUserId("0125xxxx0251487");
OapiExtcontactDeleteResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiExtcontactDeleteRequest("https://api.dingtalk.io/topapi/extcontact/delete")
req.user_id="0125xxxx0251487"
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 OapiExtcontactDeleteRequest;
$req->setUserId("0125xxxx0251487");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/extcontact/delete");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/extcontact/delete");
OapiExtcontactDeleteRequest req = new OapiExtcontactDeleteRequest();
req.UserId = "0125xxxx0251487";
OapiExtcontactDeleteResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Response
Response body
| Name | Type | Example | Description |
|---|---|---|---|
| errcode | Number | 0 | The return code. |
| request_id | String | 439eqp31da45 | The request ID. |
Response body example
{
"errcode":0,
"request_id": "439eqp31da45"
}
Error codes
If an error occurs when calling this API, refer to the Global error codes document to find a solution based on the error message.| Error code (errcode) | Error message (errmsg) | Solution |
|---|---|---|
| 33009 | Invalid tokenGrantType | Check whether the access_token is correct. |
| 33012 | Invalid userId | Check whether the userId is correct. |
| 43007 | Operation permission is required | Check whether the access_token has the required operation permissions. |
| 400001 | System error | Try again later. |