Check Friend Relationships
Check friend relationships between users.
Enable the Service
Before calling this API, enable the profile hosting service by submitting a ticket.
Request Method
POST: https://data center domain/friend/check.json
Rate Limit: 100 requests per second (Note: Batch operations count as multiple requests. Checking 10 friends counts as 10 API calls)
Signature Rules: All server API requests require signature verification. See API Request Signature.
Request Parameters
The HTTP request body uses application/x-www-form-urlencoded
format with these parameters:
Parameter | Type | Required | Description |
---|---|---|---|
userId | String | Yes | Operator user ID |
targetIds | String[] | Yes | Target user IDs to check (max 100 IDs) |
Request Example
POST /friend/check.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&targetIds=id2,id3,id4
Response
The HTTP response contains a JSON object with this structure:
Field | Type | Description |
---|---|---|
code | Number | Status code (200 for success) |
results | Object[] | Check results array |
results[i].userId | String | Target user ID |
results[i].result | Number | 1. No mutual friendship 2. Reserved 3. Reserved 4. Mutual friendship |
Response Example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code": 200,
"results":[
{
"userId":"id2",
"result":1
},
{
"userId":"id3",
"result":2
},
{
"userId":"id4",
"result":3
}
]
}