Friendships/show
目录 |
friendships/show
返回两个用户关系的详细情况
Returns detailed information about the relationship between two users.
URL:
http://api.t.sina.com.cn/friendships/show.format
Formats:
xml, json
HTTP Method(s):
GET
Requires Authentication (about authentication):
false (see usage notes)
API rate limited (about rate limiting):
true
Parameters:
如果请求没做身份验证,下面参数为必选一个:
- source_id. 要判断的源用户UID
o Example: http://api.t.sina.com.cn/friendships/show.xml?source_id=123
- source_screen_name. T要判断的源用户帐号
o Example: http://api.t.sina.com.cn/friendships/show.xml?source_screen_name=bob 下面参数必须选填一个:
- target_id. 要判断的目的用户UID
o Example: http://api.t.sina.com.cn/friendships/show.xml?target_id=456
- target_screen_name. 要判断的目的用户帐号
o Example: http://api.t.sina.com.cn/friendships/show.xml?target_screen_name=jack
One of the following is required if the request is unauthenticated:
- source_id. The user_id of the subject user.
o Example: http://api.t.sina.com.cn/friendships/show.xml?source_id=123
- source_screen_name. The screen_name of the subject user.
o Example: http://api.t.sina.com.cn/friendships/show.xml?source_screen_name=bob One of the following is required:
- target_id. The user_id of the target user.
o Example: http://api.t.sina.com.cn/friendships/show.xml?target_id=456
- target_screen_name. The screen_name of the target user.
o Example: http://api.t.sina.com.cn/friendships/show.xml?target_screen_name=jack
Usage Notes:
- 如果用户已登录,此接口将自动使用登陆用户ID左右源ID。就算指定了源ID也将使用登陆用户来作为源ID来查询关系
- 如果来源是没有指定一个未经验证的请求,将返回http的403错误
- 如果源用户或目的用户不存在,将返回http的403错误
- 消息格式的定义,晚点补充
- If this method is invoked as an authenticated request, the method will use the authenticated user as the source user implicitly. However, a source explicitly specified with parameters will override an authenticated user as the source of the relationship query.
- If the source is not specified for an unauthenticated request, the method will return an HTTP 403.
- If a source or target is specified but does not exist, the method will return an HTTP 404.
- The <notifications_enabled> element will only be returned for an authenticated source user within the <source> element. Notification data is not publicly available data and therefore remains restricted to authenticated users within the API. For unauthenticated source users and target users, the <notifications_enabled> element will be empty.
- This method returns redundant data, in that the bi-directional relationship of the source and target can be determined by looking at the <following> and <followed_by> element within either the <source> or <target> nodes. We deliver this data twice in denormalized form for convenience and increased readability.
Response (about return values):
XML example:
<?xml version="1.0" encoding="UTF-8"?> <relationship> <source> <id>123</id> <screen_name>bob</screen_name> <following>true</following> <followed_by>false</followed_by> <notifications_enabled>false</notifications_enabled> </source> <target> <id>456</id> <screen_name>jack</screen_name> <following>false</following> <followed_by>true</followed_by> <notifications_enabled></notifications_enabled> </target> </relationship>
JSON example:
{"relationship": { "source": { "id": 123, "screen_name": "bob", "following": true, "followed_by": false, "notifications_enabled": false }, "target": { "id": 456, "screen_name": "jack", "following": false, "followed_by": true, "notifications_enabled": null } } }
Usage examples:
cURL (about cURL):
curl -u user:password http://api.t.sina.com.cn/friendships/show.xml?target_id=456