Get User Friend List
Retrieve the friend list of a specified user.
Enable the Service
Before calling this API, enable the profile hosting service by submitting a ticket.
Request Method
POST: https://data center domain/friend/get.json
Rate Limit: 100 requests per second
Signature Rule: All server API requests require signature verification. See API Request Signature for details.
Request Parameters
The HTTP request body uses application/x-www-form-urlencoded
format and supports the following form parameters:
Parameter | Type | Required | Description |
---|---|---|---|
userId | String | Yes | Operator user ID |
pageToken | String | No | Pagination token for query traversal. Omit for first request, use returned token for subsequent requests |
size | String | No | Number of items per request. Default: 50, Max: 100 |
order | String | No | Sort order: 0. By friend addition time ascending (default); 1. By friend addition time descending |
Request Example
POST /friend/get.json HTTP/1.1
Host: api.rong-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/x-www-form-urlencoded
userId=id1&pageToken=XM2AKD1B2AH&size=60&order=1
Response
The HTTP response body contains a JSON object with the following structure:
Field | Type | Description |
---|---|---|
code | Number | Status code. 200 indicates success. |
pageToken | String | Pagination token for next query |
totalCount | Number | Total friend count |
friendList | JsonArray | List of friend objects |
friendList[i].userId | String | Friend user ID |
friendList[i].name | String | Friend name |
friendList[i].remarkName | String | Friend remark name |
friendList[i].friendExtProfile | String | Friend's custom attributes |
friendList[i].time | Number | Friend addition timestamp (milliseconds) |
Response Example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code": 200,
"pageToken":"XM2AKD1B2AH",
"totalCount":200,
"friendList":[
{
"userId":"id2",
"name":"zhangsan",
"remarkName":"zs",
"friendExtProfile":"{\"ext_key1\":\"value1\",\"ext_key2\":\"value2\"}",
"time":1727712000000
},
{
"userId":"id3",
"name":"lisi",
"remarkName":"ls",
"friendExtProfile":"{\"ext_key1\":\"value1\"}",
"time":1727712000001
}
]
}