Host User Relationship
Update time: 2022/11/25 08:12:14
Add a friend
Adds a friend.
Request URL
httpPOST https://api-sg.netease.im/nimserver/friend/add.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
accid | String | Yes | accid of friend request initiator |
faccid | String | Yes | accid of friend request recipient |
type | int | Yes | 1 Add friend , 2 Request to add friend, 3 Agree to add friend, 4 Refuse to add friend |
msg | String | No | Request message corresponding to adding a friend, to be assembled by third party with up to 256 characters |
serverex | String | No | Server-side extension field, with a length limited to 256 This field is read-only on the client side, read-written on the server side |
curl request example
curlcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=zhangsan&faccid=lisi&type=1' 'https://api-sg.netease.im/nimserver/friend/add.action'
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"code":200
}
Valid status codes
200, 403, 414, 416, 431, 500
See Status codes .
Updating the friend profile
Updates the friend profile, such as alias. You must be a friend of the peer.
Request URL
httpPOST https://api-sg.netease.im/nimserver/friend/update.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
accid | String | Yes | Initiator accid |
faccid | String | Yes | Modify friend accid |
alias | String | No | Add a alias to friend, with a length limit of 128. You can set to an empty string |
ex | String | No | Modify an ex field, with a length limit of 256. You can set to an empty string |
serverex | String | No | Modify a serverex field, with a length limit of 256. You can set to an empty string this field is read-only on the client side, read-written on the server side |
curl request example
curlcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=zhangsan&faccid=lisi&alias=lisi' 'https://api-sg.netease.im/nimserver/friend/update.action'
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"code":200
}
Valid status codes
200, 403, 414, 416, 431, 500
See Status codes .
Removing a friend
Removes a friend.
Request URL
httpPOST https://api-sg.netease.im/nimserver/friend/delete.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
accid | String | Yes | Initiator accid |
faccid | String | Yes | Accid of a friend to be deleted |
isDeleteAlias | Boolean | No | Notes information for whether deletion is required false: not required (default), true: required |
curl request example
curlcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=zhangsan&faccid=lisi' 'https://api-sg.netease.im/nimserver/friend/delete.action'
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"code":200
}
Valid status codes
200, 403, 414, 416, 431, 500
See Status codes .
Getting the friendship chain
Queries bilateral friendship from a certain point of time to date.
Request URL
httpPOST https://api-sg.netease.im/nimserver/friend/get.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
accid | String | Yes | Initiator accid |
updatetime | Long | Yes | Update timestamp, friends list will be updated upon return of new timestamp by interface |
createtime | Long | No | [Deprecated] definition is the same as that of updatetime |
curl request example
curlcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=zhangsan&createtime=1443599631111' 'https://api-sg.netease.im/nimserver/friend/get.action'
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"code":200,
"size":2,
"friends":
[
{"createtime":1440037706987,"bidirection":true,"faccid":"t2"},
{"createtime":1440037718190,"bidirection":true,"faccid":"t3","alias":"t3"}
]
}
Valid status codes
200, 403, 414, 416, 431, 500
See Status codes .
Adding a friend to a blocklist or muting a friend
Blocks or unblocks a friend. Mute or unmute a friend.
Request URL
httpPOST https://api-sg.netease.im/nimserver/user/setSpecialRelation.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
accid | String | Yes | User account, with a maximum length of 32 characters, must be unique Unique with the APP |
targetAcc | String | Yes | Accounts that have been blocklisted or muted |
relationType | int | Yes | Relationship type of the operation, 1: blocklist, 2: mute list |
value | int | Yes | Operation value, 0: cancel blocklist or mute, 1: add to blocklist or mute list |
curl request example
curlcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=zhangsan&targetAcc=lisi&relationType=1&value=0' 'https://api-sg.netease.im/nimserver/user/setSpecialRelation.action'
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"code":200
}
Valid status codes
200, 403, 414, 416, 431, 500
See Status codes .
View the blocklist and mute list of specified user
Views the blocklist and mute list of users.
Request URL
httpPOST https://api-sg.netease.im/nimserver/user/listBlackAndMuteList.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
accid | String | Yes | User account, with a maximum length of 32 characters, must be unique Unique with the APP |
curl request example
curlcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=zhangsan' 'https://api-sg.netease.im/nimserver/user/listBlackAndMuteList.action'
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"mutelist": [//List of muted accounts
"abc",
"cde"
],
"Blocklist": [//list of blocklisted accounts
"abc"
],
"code": 200
}
Valid status codes
200, 403, 414, 416, 431, 500
See Status codes .