device-docking/爱牵挂/爱牵挂M1对外API/auth.md
2023-12-20 11:48:09 +08:00

4.3 KiB
Executable File
Raw Blame History

如果是post请求把参数带到body里面禁止写到URL后面。URL后面带参数的全是get请求。 我们的测试服虽然get和post请求都可以使用但是要是用规范改post请求的时候必须post请求并且把参数放到body下不要放到URL后面。我们的正式服因为换过架构所以会更加规范修改接口必须是post且放到body下进行请求

身份验证

登录

  • 地址: /api/auth/login

  • 方法: POST

  • 响应对象: person 简化

  • 请求参数:

    名称 必须 类型 说明
    username string 填用户名或手机号
    password string 填用户密码或短信密码
  • 请求范例:

    curl -v -A CURL -d "username=demo&password=admin" -c cookies.txt http://127.0.0.1:8888/api/auth/login
    
  • 响应Cookie:

    Set-Cookie: user="2|1:0|10:1407508841|4:user|8:YWRtaW4=|19bf2a8edd510eca173cecff546c446e3d800ae34ca3649ec56a566d2386e0de"; expires=Sun, 07 Sep 2014 14:40:41 GMT; Path=/
    
  • 响应范例:

    {
    "obj": {
        "_id": {
            "$oid": "5bda53d2264251367f5a4385"
        },
        "username": "18838030850",
        "nickname": "伟东",
        "phone": "18838030850",
        "devicetokens": [
            {
                "token_type": "android",
                "token": "1a0018970a2e98b8f46",
                "push_server": "jiguang",
                "app": "aiqiangua2.0",
                "is_enable_aliase": false,
                "created_at": {
                    "$date": 1596816909955
                }
            },
            {
                "token_type": "android",
                "token": "100d8559094809f80ca",
                "push_server": "jiguang",
                "uuid": "aiqiangua2.0|74ef4ed806e282ac",
                "app": "aiqiangua2.0",
                "brand": "motorola",
                "phone_type": "xt1079",
                "system_version": "21",
                "is_enable_aliase": false,
                "created_at": {
                    "$date": 1599846173229
                }
            },
            {
                "token_type": "ios",
                "token": "191e35f7e029c78a600",
                "push_server": "jiguang",
                "uuid": "aiqiangua2.0|DBB4C34C-46F1-407C-B0B4-265FB438E3CF",
                "app": "aiqiangua2.0",
                "brand": "apple",
                "phone_type": "iPhone12,5",
                "system_version": "13.6.1",
                "is_enable_aliase": false,
                "created_at": {
                    "$date": 1603189431007
                }
            },
            {
                "token_type": "ios",
                "token": "121c83f7604cef30bbb",
                "push_server": "jiguang",
                "uuid": "aiqiangua2.0|8F945CF7-31E5-4631-A93C-8B1A8F867C37",
                "app": "aiqiangua2.0",
                "brand": "apple",
                "phone_type": "iPhone 5c (GSM)",
                "system_version": "10.3.3",
                "is_enable_aliase": false,
                "created_at": {
                    "$date": 1603290768443
                }
            }
        ],
        "weight": 80,
        "height": 166,
        "birthday": "2006-11-01",
        "avatar": "18838030850.png",
        "avatar_url": "/media/avatar/200/18838030850.jpg",
        "community": {
            "$oid": "5bed061726425171d55ab8a7"
        },
        "gender": "male",
        "address": "科学城",
        "location_enable": true,
        "care_code": "32434385",
        "devices": [],
        "groups": [
            {
                "$oid": "5dc3cc002642513d1356da38"
            },
            {
                "$oid": "5bdc212e26425136804939f0"
            },
            {
                "$oid": "5cd902d626425177be24be3e"
            },
            {
                "$oid": "5d52182c264251738f99f4ef"
            },
            {
                "$oid": "5dcbc4e92642513d1356db10"
            },
            {
                "$oid": "5f584f4c2642511f21c77c9f"
            },
            {
                "$oid": "5f12c3762642517d70510f7d"
            },
            {
                "$oid": "5f8eae282642510b4bd152f2"
            }
        ],
        "bluetoothdevices": [],
        "sleepdevices": [
            "d069e6fae982"
        ]
    },
    "success": true,
    "obj_name": "person"
    }