Get friend list
Retrieve a user's friend list.
Request method
POST: https://Base URL/v4/friend/list
Rate limit: 100 requests per second
Signature required: All server API requests require signature verification. See API request signature.
Request body
The request body is in application/json format and supports the following parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
userId | String | Yes | The user ID. |
pageToken | String | No | Pagination token. Omit for the first request. Use the value returned from the previous response for subsequent pages. |
pageSize | String | No | Items per page. Defaults to 50. Maximum 100. |
order | String | No | Sort order: 0 = ascending by friend addition time (default). 1 = descending by friend addition time. |
Request example
HTTP
POST /v4/friend/list HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/json
{
"userId": "id1",
"pageToken": "XM2AKD1B2AH",
"pageSize": 60,
"order": 1
}
Response
| Field | Type | Description |
|---|---|---|
code | Number | Status code. 0 indicates success. |
result.pageToken | String | Pagination token for the next page. |
result.totalCount | Number | Total number of friends. |
result.friends | Array | List of friend objects. |
result.friends[i].userId | String | The friend's user ID. |
result.friends[i].name | String | The friend's name. |
result.friends[i].alias | String | The friend's alias (remark name). |
result.friends[i].friendExtProfile | String | Custom extended attributes. |
result.friends[i].addedAt | Number | Timestamp (ms) when the friend was added. |
Response example
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code": 0,
"result": {
"pageToken": "XM2AKD1B2AH",
"totalCount": 200,
"friends": [
{
"userId": "id2",
"name": "zhangsan",
"alias": "zs",
"extraProfile": "{\"ext_key1\":\"value1\",\"ext_key2\":\"value2\"}",
"addedAt": 1727712000000
},
{
"userId": "id3",
"name": "lisi",
"alias": "ls",
"extraProfile": "{\"ext_key1\":\"value1\"}",
"addedAt": 1727712000001
}
]
}
}