用户信息

用户信息

DeepinID提供基本的用户信息查询/修改接口. 修改接口接口权限不对第三方开发人员开放。

当前版本: v1

旧版本接口参考文档: 待定。

TODO List:

  • [ ] 补充旧版接口文档
  • [ ] 补充用户信息修改删除文档

1 获取单个用户信息(无授权)

1.1 API Endpoint

GET https://api.deepin.org/v1/users/:indentify

1.2 Request Parameters

Url Parameter

参数名称 描述
:indentify 用户标识,可以是用户名,用户邮箱

Example:

GET https://api.deepin.org/v1/users/iceyer

1.3 Respone

Return 200 and user info when user is exist:

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

{
    "uid": 17898,
    "username": "Iceyer",
    "profile_image": "http://u.deepin.org/ucenter_server/avatar.php?uid=17898"
}

Return 404 if user is NOT exist:

HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8

{"message":"user_not_exist"}

2 获取多个用户信息(无授权)

2.1 API Endpoint

GET https://api.deepin.org/v1/users

2.2 Request Parameters

Query String Parameter:

参数名称 描述
id UID
username 用户名
email 邮箱

相同名称参数是或的关系,在服务器端解析query string时,认为如下形式表示array:

uid=1&uid=2&uid=3

等价于:

{
    "id": [1,2,3]
}

建议同时只能通过一种参数查询,因为各个不同名称参数之间是”与“关系。

Example:

GET https://api.deepin.org/v1/users?uid=17898&uid=7045
GET https://api.deepin.org/v1/users?email=iceyers@gmail.com&email=snyh@snyh.org

2.3 Respone

Return 200 and user info when user is exist:

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

[
    {
        "uid": 7045,
        "username": "snyh1010",
        "profile_image": "http://u.deepin.org/ucenter_server/avatar.php?uid=7045"
    },
    {
        "uid": 17898,
        "username": "Iceyer",
        "profile_image": "http://u.deepin.org/ucenter_server/avatar.php?uid=17898"
    }
]

Return 404 if user is NOT exist:

HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8

{"message":"Invaild User Name"}

3 获取授权用户信息

3.1 API Endpoint

GET https://api.deepin.org/v1/user

2.2 Request Parameters

OAuth2 Scope:

user:read

Header Parameter:

参数名称 描述
Access-Token 用户通过oauth授权获得的token

Example:

curl -v -H Access-Token:OWNjN2QyMTMt https://api.deepin.org/v1/user

3.3 Respone

Return 200 and user info when user is exist:

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

{
    "uid": 17898,
    "username": "Iceyer",
    "scope": "base,user:read",
    "profile_image": "http://u.deepin.org/ucenter_server/avatar.php?uid=17898",
    "website": "",
    "signature": ""
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注