Friendships/show
(→friendships/show) |
|||
第1行: | 第1行: | ||
== friendships/show == | == friendships/show == | ||
返回两个用户关系的详细情况 | 返回两个用户关系的详细情况 | ||
− | |||
− | |||
=== URL: === | === URL: === | ||
http://api.t.sina.com.cn/friendships/show.format | http://api.t.sina.com.cn/friendships/show.format | ||
− | === | + | ===格式=== |
xml, json | xml, json | ||
− | === | + | === HTTP请求方式=== |
GET | GET | ||
− | === | + | ===是否需要身份验证=== |
− | + | true | |
− | === | + | ===请求数限制=== |
true | true | ||
− | === | + | ===请求参数=== |
− | + | 以下参数可不填写,如不填,则取当前用户 | |
− | * source_id. | + | * source_id. 源用户UID |
− | o | + | :o 示例: http://api.t.sina.com.cn/friendships/show.xml?source_id=10502 |
− | * source_screen_name. | + | * source_screen_name. 源用户昵称 |
− | o | + | :o 示例: http://api.t.sina.com.cn/friendships/show.xml?source_screen_name=bob |
+ | |||
下面参数必须选填一个: | 下面参数必须选填一个: | ||
* target_id. 要判断的目的用户UID | * target_id. 要判断的目的用户UID | ||
− | o Example: http://api.t.sina.com.cn/friendships/show.xml?target_id= | + | :o Example: http://api.t.sina.com.cn/friendships/show.xml?target_id=10503 |
− | * target_screen_name. | + | * target_screen_name. 要判断的目的用户昵称 |
− | o Example: http://api.t.sina.com.cn/friendships/show.xml?target_screen_name= | + | :o Example: http://api.t.sina.com.cn/friendships/show.xml?target_screen_name=timyang |
− | + | ===使用说明=== | |
− | + | * 如果用户已登录,此接口将自动使用登陆用户ID作为source_id。就算指定了源ID也将使用登陆用户来作为源ID来查询关系 | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | == | + | |
− | + | ||
− | * | + | |
* 如果源用户或目的用户不存在,将返回http的403错误 | * 如果源用户或目的用户不存在,将返回http的403错误 | ||
* 消息格式的定义,晚点补充 | * 消息格式的定义,晚点补充 | ||
− | + | ===返回=== | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | === | + | |
XML example: | XML example: | ||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
第75行: | 第54行: | ||
</target> | </target> | ||
</relationship> | </relationship> | ||
− | JSON | + | |
+ | JSON 示例: | ||
{"relationship": { | {"relationship": { | ||
"source": { | "source": { | ||
第92行: | 第72行: | ||
} | } | ||
− | === | + | ===使用示例=== |
cURL (about cURL): | cURL (about cURL): | ||
− | |||
curl -u user:password http://api.t.sina.com.cn/friendships/show.xml?target_id=456 | curl -u user:password http://api.t.sina.com.cn/friendships/show.xml?target_id=456 |
2009年12月22日 (二) 17:08的版本
目录 |
friendships/show
返回两个用户关系的详细情况
URL:
http://api.t.sina.com.cn/friendships/show.format
格式
xml, json
HTTP请求方式
GET
是否需要身份验证
true
请求数限制
true
请求参数
以下参数可不填写,如不填,则取当前用户
- source_id. 源用户UID
- source_screen_name. 源用户昵称
下面参数必须选填一个:
- target_id. 要判断的目的用户UID
- target_screen_name. 要判断的目的用户昵称
使用说明
- 如果用户已登录,此接口将自动使用登陆用户ID作为source_id。就算指定了源ID也将使用登陆用户来作为源ID来查询关系
- 如果源用户或目的用户不存在,将返回http的403错误
- 消息格式的定义,晚点补充
返回
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 示例:
{"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 } } }
使用示例
cURL (about cURL): curl -u user:password http://api.t.sina.com.cn/friendships/show.xml?target_id=456