Set friend custom attributes
Set custom attributes for a friend.
Request method
POST: https://Base URL/v4/friend/profile/set
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 performing the operation. |
targetId | String | Yes | The friend's user ID. |
alias | String | No | Friend alias (remark name). Maximum 64 characters. Omit to clear the alias. |
friendExtProfile | JSON | No | Custom extended attributes as key-value pairs. Up to 10 attributes by default. Key: maximum 32 characters, alphanumeric and _, format: ext_xxxxx. Value: maximum 256 characters. Example: {"ext_key1":"value1","ext_key2":"value2"} |
Request example
HTTP
POST /v4/friend/profile/set HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/json
{
"userId": "id1",
"targetId": "id2",
"alias": "zhangsan",
"friendExtProfile": {
"extKey1": "value1",
"extKey2": "value2"
}
}
Response
| Field | Type | Description |
|---|---|---|
code | Number | Status code. 0 indicates success. |
Response example
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code": 0
}