https://xxxxxx/v4/sns/friend_import?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json
参数 | 说明 |
xxxxxx | SDKAppID 所在国家/地区对应的专属域名: 中国: console.tim.qq.com 新加坡: adminapisgp.im.qcloud.com 首尔: adminapikr.im.qcloud.com 法兰克福: adminapiger.im.qcloud.com 硅谷: adminapiusa.im.qcloud.com 雅加达: adminapiidn.im.qcloud.com |
v4/sns/friend_import | 请求接口 |
sdkappid | 创建应用时即时通信 IM 控制台分配的 SDKAppID |
identifier | |
usersig | |
random | 请输入随机的32位无符号整数,取值范围0 - 4294967295 |
contenttype | 请求格式固定值为 json |
{"From_Account":"id","AddFriendItem":[{"To_Account":"id1","AddSource":"AddSource_Type_XXXXXXXX"}]}
{"From_Account":"id","AddFriendItem":[{"To_Account":"id1","Remark":"remark1","RemarkTime":1420000001,"GroupName":["朋友"],"AddSource":"AddSource_Type_XXXXXXXX","AddWording":"I'm Test1","AddTime":1420000001,"CustomItem":[{"Tag":"Tag_SNS_Custom_XXXX","Value":"Test"},{"Tag":"Tag_SNS_Custom_YYYY","Value":0}]}]}
{"From_Account":"id","AddFriendItem":[{"To_Account":"id1","AddSource":"AddSource_Type_XXXXXXXX"},{"To_Account":"id2","Remark":"remark2","RemarkTime":1420000001,"GroupName":["朋友"],"AddSource":"AddSource_Type_XXXXXXXX","AddWording":"I'm Test2","AddTime":1420000001},{"To_Account":"id3","Remark":"remark3","RemarkTime":1420000001,"GroupName":["同事","朋友"],"AddSource":"AddSource_Type_XXXXXXXX","AddWording":"I'm Test3","AddTime":1420000001,"CustomItem":[{"Tag":"Tag_SNS_Custom_XXXX","Value":"Test"},{"Tag":"Tag_SNS_Custom_YYYY","Value":0}]}]}
字段 | 类型 | 属性 | 说明 |
From_Account | String | 必填 | 需要为该 UserID 添加好友 |
AddFriendItem | Array | 必填 | 好友结构体对象,单次请求的好友数不得超过1000 |
To_Account | String | 必填 | 好友的 UserID |
Remark | String | 选填 | |
RemarkTime | Integer | 选填 | From_Account 对 To_Account 的好友备注时间 |
GroupName | Array | 选填 | |
AddSource | String | 必填 | |
AddWording | String | 选填 | |
AddTime | Integer | 选填 | From_Account 和 To_Account 形成好友关系的时间 |
CustomItem | Array | 选填 | |
Tag | String | 选填 | |
Value | String/Integer | 选填 | 自定义好友字段的值 |
{"ResultItem":[{"To_Account":"id1","ResultCode":0,"ResultInfo":""}],"ActionStatus":"OK","ErrorCode":0,"ErrorInfo":"","ErrorDisplay":""}
{"ResultItem":[{"To_Account":"id1","ResultCode":0,"ResultInfo":""},{"To_Account":"id2","ResultCode":30010,"ResultInfo":"Err_SNS_FriendImport_My_Friend_Num_Exceed_Threshold"},{"To_Account":"id3","ResultCode":30002,"ResultInfo":"Err_SNS_FriendImport_SdkAppId_Illegal"}],"Fail_Account":["id2","id3"],"ActionStatus":"OK","ErrorCode":0,"ErrorInfo":"","ErrorDisplay":""}
字段 | 类型 | 说明 |
ResultItem | Array | 批量加好友的结果对象数组 |
To_Account | String | 请求添加的好友的 UserID |
ResultCode | Integer | To_Account 的处理结果,0表示成功,非0表示失败,非0取值的详细描述请参见 错误码说明 |
ResultInfo | String | To_Account 的错误描述信息,成功时该字段为空 |
Fail_Account | Array | 返回处理失败的用户列表,仅当存在失败用户时才返回该字段 |
ActionStatus | String | 请求处理的结果,OK 表示处理成功,FAIL 表示失败 |
ErrorCode | Integer | |
ErrorInfo | String | 详细错误信息 |
ErrorDisplay | String | 详细的客户端展示信息 |
错误码 | 描述 |
30001 | 请求参数错误,请根据错误描述检查请求参数 |
30002 | SDKAppID 不匹配 |
30003 | 请求的用户账号不存在 |
30004 | 请求需要 App 管理员权限 |
30006 | 服务器内部错误,请重试 |
30007 | 网络超时,请稍后重试 |
30008 | 并发写导致写冲突,建议使用批量方式 |
30010 | 好友数已达系统上限 |
30011 | 分组已达系统上限 |
本页内容是否解决了您的问题?