用户

{USER_ID}作为唯一的用户身份,对于所有请求,“me”是用于请求用户本身代替{user_id}。用户对象提供了以下属性:

名称 描述
ID 用户ID UiaduESWsbzFoK9TOldC6zF
email 用户电子邮件地址 john.doe@acme.com
first_name 用户名
last_name 用户姓氏
name 用户全名 李四
UNIQUE_ID 用户为unique_id创建而非电子邮件创建时的用户unique_id A3451UX2349
picture_uri 用户头像链接 https://www.betalk.com/user/2342
type 用户类型 USER_TYPE_NORMAL
created_time 创建用户对象时的时间戳 1348864985783
updated_time 用户对象更新的时间戳 1348864985783

1. 获取用户

通过{USER_ID}获得用户对象的内容

GET /{USER_ID}

例:

GET /me

响应:

{
    "code": "RESPONSE_SUCCESS",
    "data": {
        "id": "UiaduESWsbzFoK9TOldC6zF",
        "email": "jim@test.com",
        "name": "jim test",
        "first_name": "jim",
        "last_name": "test",
        "picture_uri": "https://www.BeTalk.com/user/2342",
        "type": "USER_TYPE_NORMAL",
        "created_time": 1348864985783,
        "updated_time": 1348864985783
    }
}

 2. 更新用户配置文件

通过{user_id } 更新输入的值。

POST /{USER_ID}

JSON 参数

Name 类型 描述
first_name String 用户的名字
last_name String 姓氏
timezone String 可选:根据TZ字符串中的时区信息数据库该用户的时区。例如,美洲/洛杉矶,亚洲/上海。

请求:

POST /me
{
    "first_name": "Hazel",
    "last_name": "Nutt"
}			

响应:

{
    "code": "RESPONSE_SUCCESS"
}

 3. 上传用户头像

通过{USER_ID}更新用户资料头像

例:POST /{USER _ID}/picture

参数:

Name 类型 描述
file 文件 个人资料照片,编码为表单数据。

请求:

POST /me/picture
...
Content-Type: multipart/form-data; boundary=---------------------------9051914041544843365972754266
Content-Length: 384

-----------------------------9051914041544843365972754266
Content-Disposition: form-data; name="file"; filename="avatar.jpg"
Content-Type: image/jpg

Content of avatar.jpg

响应:

{
    "code": "RESPONSE_SUCCESS",
    "data": {
        "revision": 168,
        "updated_time": 1348864985783
    }
}

 4. 获取用户个人资料图片

获取用户的个人资料图片由{USER_ID}确定。

GET /{USER_ID}/picture

请求:

GET /me/picture

响应:

#Profile Picture

5. 删除用户个人资料图片

根据{USER_ID}删除用户的个人资料图片。

DELETE /{USER_ID}/picture

请求:

DELETE /me/picture

响应:

{
    "code": "RESPONSE_SUCCESS"
}

 6. 获取用户的时间流

根据{USER_ID}获取用户时间流的所有活动。

GET/ {USER_ID} /timeline

URL参数

filter String 可选:“unreadfeeds” –返回未阅读回复
Sort String 可选:“时间” –按时间戳倒序排列返回回复

例:

GET/ME/timeline

响应:

{
    "code": "RESPONSE_SUCCESS",
    "data": {
        "feeds": [
            {
                "object": {
                    "id": "128",
                    "content": "<p>Hello</p>",
                    "objectType": "comment",
                    "updated": "2013-08-16T01:46:07Z",
                    "published": "2013-08-16T01:46:07Z"
                },
                "target": {
                    "id": "6",
                    "type": "PAGE_TYPE_IMAGE",
                    "url": "https://www.betalk.com/Be0pVl0vaYeI5RKtLRqnfM9/6",
                    "objectType": "page",
                    "updated": "1970-01-01T00:00:00Z",
                    "published": "1970-01-01T00:00:00Z"
                },
                "actor": {
                    "image": null,
                    "id": "Utkj3YC5BxRHCCaq9widP67",
                    "displayName": "John Wess",
                    "objectType": "person",
                    "updated": "2013-05-22T21:21:36Z",
                    "published": "2013-05-22T21:21:36Z"
                },
                "generator": {
                    "id": "Be0pVl0vaYeI5RKtLRqnfM9"
                },                
                "published": "2013-08-16T01:46:07Z",
                "verb": "post"
            },
            {
                "object": {
                    "objectType": "annotation",
                    "updated": "2013-08-29T22:05:45Z",
                    "published": "2013-08-29T22:05:45Z"
                },
                "target": {
                    "id": "40",
                    "type": "PAGE_TYPE_IMAGE",
                    "url": "https://www.betalk.com/BRTaH8slmbPAY4odz0RbBIF/40",
                    "objectType": "page",
                    "updated": "1970-01-01T00:00:00Z",
                    "published": "1970-01-01T00:00:00Z"
                },
                "actor": {
                    "image": null,
                    "id": "Utkj3YC5BxRHCCaq9widP67",
                    "displayName": "John Wess",
                    "objectType": "person",
                    "updated": "2013-09-09T22:00:23Z",
                    "published": "2013-05-22T21:21:36Z"
                },
                "generator": {
                    "id": "BRTaH8slmbPAY4odz0RbBIF"
                },                
                "published": "2013-08-29T22:05:45Z",
                "verb": "update"
            },
            {
                "object": null,
                "target": {
                    "id": "Bj0GDAOoP48Cllc9wlGK3vE",
                    "displayName": "Crystal",
                    "url": "https://www.betalk.com/Bj0GDAOoP48Cllc9wlGK3vE",
                    "image": "https://www.betalk.com/images/binder/default_cover.png",
                    "objectType": "binder",
                    "updated": "2013-08-16T01:36:46Z",
                    "published": "2013-07-03T17:38:59Z"
                },
                "actor": {
                    "image": null,
                    "id": "Utkj3YC5BxRHCCaq9widP67",
                    "displayName": "John Wess",
                    "objectType": "person",
                    "updated": "2013-08-16T01:36:46Z",
                    "published": "2013-07-03T17:39:00Z"
                },
                "generator": {
 "id": "Bj0GDAOoP48Cllc9wlGK3vE"
                },                
                "published": "2013-08-16T01:36:46Z",
                "verb": "join"
            }
        ]
    }
}

7.  获取用户的未读回复

根据{USER_ID}获取用户的未读消息的数目。

GET/ {USER_ID} / unreadfeeds

例:

GET / ME / unreadfeeds

响应:

{
    "code": "RESPONSE_SUCCESS",
    "data": {
      "unread_feeds": 3
    }
}