Request
| Basic information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/chat/member/friendswitch/update |
| HTTP Method | POST |
| Supported app types | appType-Internal app |
| Required permissions | permission-qyapi_chat_manage-DingTalk group basic information management permission |
Query parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | 6d1bxxxx | The App credential for calling this API. Obtain it through the API for getting the access_token of an Internal app. |
Request body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| chatid | String | Yes | chatdafe234xxxx | The Chat ID of the organization. Obtain it in one of the following ways: - Call the Server-side API for creating a group to obtain the value of the chatid parameter. - Call the Client-side chooseChat API to obtain the value of the chatId parameter. |
| is_prohibit | Boolean | Yes | true | Whether to turn on the restriction switch. - true: Turn on the restriction switch. - false: Turn off the restriction switch. |
Request example
curl -X POST "https://api.dingtalk.io/topapi/chat/member/friendswitch/update" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=774fdexxxx4bdd68c' \
-d 'chatid=chatdafe234sdf3sdf' \
-d 'is_prohibit=true'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/chat/member/friendswitch/update");
OapiChatMemberFriendswitchUpdateRequest req = new OapiChatMemberFriendswitchUpdateRequest();
req.setChatid("chatdafe234xxxx");
req.setIsProhibit(true);
OapiChatMemberFriendswitchUpdateResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiChatMemberFriendswitchUpdateRequest("https://api.dingtalk.io/topapi/chat/member/friendswitch/update")
req.chatid="chatdafe234sdf3sdf"
req.is_prohibit=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 OapiChatMemberFriendswitchUpdateRequest;
$req->setChatid("chatdafe234sdf3sdf");
$req->setIsProhibit("true");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/chat/member/friendswitch/update");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/chat/member/friendswitch/update");
OapiChatMemberFriendswitchUpdateRequest req = new OapiChatMemberFriendswitchUpdateRequest();
req.Chatid = "chatdafe234sdf3sdf";
req.IsProhibit = true;
OapiChatMemberFriendswitchUpdateResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Response
Response body
| Name | Type | Example | Description |
|---|---|---|---|
| success | Boolean | true | Whether the configuration is successful. - true: Success. - false: Failed. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| request_id | String | 10c0wc48i6qzz | The request ID. |
Response example
{
"success":true,
"errcode":0,
"errmsg":"ok",
"request_id":"10c0wc48i6qzz"
}
Error codes
If an error is returned when you call this API, refer to the Global error codes documentation for solutions.| Error code (errorcode) | Error message (errmsg) | Solution |
|---|---|---|
| 34001 | Invalid chatid | Check whether the chatid meets the requirements. |
| 40036 | Empty parameter | Confirm that all required parameters have been provided. |
| 400001 | system error | Try again later. |