Skip to content
freedom7 edited this page Jul 22, 2013 · 8 revisions

登录

URL /login/
POST {username,password}
response[‘Auth_Response’] 0:登录成功,1:用户不存在,2:密码错误
response[‘API_Key’] 用户的key

请求数据

请求资源时应当附带两个参数,username,api_key 例如 http://127.0.0.1:8800/api/data/account/?username=ihkey&api_key=176e5a657152c75287bbd03a4da2da29f84d13ed

请求用户账户资料

URL /api/data/account/ 返回数据示例

{

    "meta": {
        "limit": 20,
        "next": null,
        "offset": 0,
        "previous": null,
        "total_count": 1
    },
    "objects": [
        {
            "hobby": "aaaa",
            "id": 5,
            "resource_uri": "/api/data/account/5/",
            "user": {
                "date_joined": "2013-07-21T21:28:46.987886",
                "email": "",
                "first_name": "",
                "id": 6,
                "last_login": "2013-07-21T21:50:48.651590",
                "last_name": "",
                "resource_uri": "/api/data/user/6/",
                "username": "ihkey"
            }
        }
    ]

}

字段说明

“hobby” 爱好 “aaaa”
“id” 在数据库ID 5
“resource_uri” 请求url api/data/account/5
“user” 外键指向User
“date_joined” 注册日期 “2013-07-21T21:28:46.987886”
“email” 邮件 ””
“first_name” ””
“id” userID 6
“last_login” 上次登录时间 “2013-07-21T21:50:48.651590”
“last_name” ””
“resource_uri” user对应请求url api/data/user/6
“username” 用户名 “ihkey”

字段说明日后补上

请求时间段

URL /api/data/timedetail/

返回数据示例

{

    "meta": {
        "limit": 20,
        "next": null,
        "offset": 0,
        "previous": null,
        "total_count": 2
    },
    "objects": [
        {
            "end_time": "10:00:00",
            "free": true,
            "id": 1,
            "level": 3,
            "resource_uri": "/api/data/timedetail/1/",
            "start_time": "08:00:00",
            "weekday": "1"
        },
        {
            "end_time": "16:00:00",
            "free": false,
            "id": 2,
            "level": 3,
            "resource_uri": "/api/data/timedetail/2/",
            "start_time": "14:00:00",
            "weekday": "1"
        }
    ]

}

请求假期时间

URL /api/data/datedetail/

返回数据示例

{

    "meta": {
        "limit": 20,
        "next": null,
        "offset": 0,
        "previous": null,
        "total_count": 1
    },
    "objects": [
        {
            "account": "/api/data/account/2/",
            "end_date": "2013-10-07",
            "id": 1,
            "level": 3,
            "resource_uri": "/api/data/datedetail/1/",
            "start_date": "2013-10-01"
        }
    ]

}

请求朋友圈

URL /api/data/usergroup/

返回数据示例

{

    "meta": {
        "limit": 20,
        "next": null,
        "offset": 0,
        "previous": null,
        "total_count": 1
    },
    "objects": [
        {
            "account": "/api/data/account/2/",
            "group_name": "狐朋狗友",
            "id": 1,
            "member": [
                "/api/data/user/3/",
                "/api/data/user/4/"
            ],
            "resource_uri": "/api/data/usergroup/1/"
        }
    ]

}

请求时间公开方案

URL /api/data/showmethod/

返回数据示例

{

    "meta": {
        "limit": 20,
        "next": null,
        "offset": 0,
        "previous": null,
        "total_count": 1
    },
    "objects": [
        {
            "account": "/api/data/account/2/",
            "id": 1,
            "resource_uri": "/api/data/showmethod/1/",
            "showmethod_name": "默认"
        }
    ]

}
Clone this wiki locally