Skip to main content

Set Friend Custom Attributes

Set custom attributes for friends.

Enable the Service

Before calling this API, enable the profile hosting service by submitting a ticket.

Request Method

POST: https://data center domain/friend/profile/set.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:

ParameterTypeRequiredDescription
userIdStringYesOperator user ID
targetIdStringYesTarget friend ID
remarkNameStringNoFriend alias (max 64 characters). Leave empty to clear existing alias
friendExtProfileStringNoCustom attributes: Developers can add custom extended attributes (Key/Value pairs) based on business needs. Default supports up to 10 extensions. Key format: lowercase letters + numbers + '_' (max 32 chars), must follow ext_xxxxx pattern. Value max 256 chars. Example: {"ext_key1":"value1","ext_key2":"value2"}

Request Example

POST /friend/profile/set.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&targetId=id2&remarkName=zhangsan&friendExtProfile={\"ext_key1\":\"value1\",\"ext_key2\":\"value2\"}

Response

The HTTP response body contains a JSON object with the following structure:

FieldTypeDescription
codeNumberStatus code (200 indicates success)

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
"code": 200,
}