美文网首页
得到部分接口分析

得到部分接口分析

作者: 小程有话说 | 来源:发表于2017-12-23 11:34 被阅读59次

    分析得到接口主要目的是学习接口地址,参数设置结构。

    得到接口都是POST请求,请求头无参数。

    个人信息

    登录

    https://dedao.igetget.com/v3//user/mobileLogin?sign=7e4810a4834b2c14d0df3185f9ebb6b8
    
    入参
    {
        "device": "ANDROID",
        "pwd": "caf96af14b15052199f79fbb8c45fb81", # 对用户密码md5结果
        "system": "手机型号:H30-T00,SDK版本:17,系统版本:4.2.2",
        "countrycallingcodes": "86",
        "source": "4",
        "h": {
            "dt": "phone",
            "os": "ANDROID",
            "hitdot": "",
            "ov": "4.2.2",
            "d": "3d39728305821dc4", # 设备信息
            "dv": "H30-T00", # 机型
            "scr": "2.0",
            "chil": "4",
            "ts": "1513857871",
            "net": "WIFI",
            "av": "3.1.3",
            "v": "2",
            "u": "0",
            "seid": "36ba256e2ba254b841d2299c0a6a1ddb",
            "t": "json",
            "s": "21a6273d2dc033e8",
            "thumb": "m",
            "adv": "1"
        },
        "mobile": "18539056269"
    }
    出参
    {
        "h": {
            "c": 0,
            "e": "",
            "t": 0.097486972808838,
            "s": 1513859444
        },
        "c": {
            "user_id": 15167958,
            "id": 15167958,
            "userid": 15167958,
            "nickname": "...",
            "avatar": "...",
            "avatar_s": "...",
            "age": "",
            "sex": 1,
            "wechat": "",
            "phone": "...",
            "countrycallingcodes": "",
            "isbindwehchat": 1,
            "hasRelated": 0
        }
    }
    

    登出

    https://dedao.igetget.com/v3//user/clearDevice?sign=3821b8d9bafb549b03d9da05a4699785
    
    {
        "h": {
            ...
        }
    }
    

    找回密码

    https://dedao.igetget.com/v3//user/sendForgetPWDSMSCode?sign=ea412c0ef2bc1d6d2c98875ff81b2c36
    
    入参
    {
        "device": "ANDROID",
        "system": "手机型号:H30-T00,SDK版本:17,系统版本:4.2.2",
        "countrycallingcodes": "86",
        "source": "4",
        "h": {
            ...
        },
        "mobile": "..."
    }
    
    回参
    {
        "h": {
            "c": 0,
            "e": "",
            "t": 0.092844009399414,
            "s": 1513859264
        },
        "c": {}
    }
    

    输入验证码

    https://dedao.igetget.com/v3//user/checkSMSCode?sign=097a548708ff024b6a8ee56bfc1d4766
    
    入参
    {
        "device": "ANDROID",
        "system": "手机型号:H30-T00,SDK版本:17,系统版本:4.2.2",
        "code": "908935",
        "countrycallingcodes": "86",
        "source": "4",
        "h": {
            ...
        },
        "mobile": "..."
    }
    出参
    {
        "h": {
            "c": 10007,
            "e": "SMS verification code fail",
            "t": 0.010223865509033,
            "s": 1513859381
        },
        "c": {}
    }
    

    重新设备密码

    https://dedao.igetget.com/v3//user/forgetpwd?sign=7a1625627f3b0e2e57f254cd0ec005df
    
    入参
    {
        "newpwd": "caf96af14b15052199f79fbb8c45fb81",
        ...
        "h": {
            ...
        },
        "mobile": "..."
    }
    出参
    {
        "h": {
            "c": 0,
            "e": "",
            "t": 0.056167125701904,
            "s": 1513859444
        },
        "c": {}
    }
    

    获取手机区号接口

    https://dedao.igetget.com/v3//country/callingcodes?sign=1a0726114e5d61f5f4497d0f268337eb
    
    入参
    {
        "source": "4",
        "device": "ANDROID",
        "system": "手机型号:H30-T00,SDK版本:17,系统版本:4.2.2",
        "h": {
            ...
        }
    }
    出参
    {
        "h": {
            "c": 0,
            "e": "",
            "t": 0.0010209083557129,
            "s": 1513998975
        },
        "c": {
            "list": [{
                "name": "\u4e2d\u56fd",
                "codes": 86
            }...]
        }
    }
    

    思考

    1. 尽量不要在HTTP请求头上携带业务信息,保持请求头的干净整洁;毕竟请求头的目的是用来描述请求特点。
    2. 适当的请求校验机制,要防止我们的请求被别人非法篡改,引入sign机制是有必要的。
    3. 规范的body结构,得到接口请求、响应body中都会有h结构,描述类似设备机型、软件版本等各种信息,感觉不太友好的是有些参数名称比如 “h”、“t”,不容易理解其含义。
    "h": {
            "dt": "phone",
            "os": "ANDROID",
            "hitdot": "",
            "ov": "4.2.2",
            "d": "3d39728305821dc4", # 设备信息
            "dv": "H30-T00", # 机型
            "scr": "2.0",
            "chil": "4",
            "ts": "1513857871",
            "net": "WIFI",
            "av": "3.1.3",
            "v": "2",
            "u": "0",
            "seid": "36ba256e2ba254b841d2299c0a6a1ddb",
            "t": "json",
            "s": "21a6273d2dc033e8",
            "thumb": "m",
            "adv": "1"
        }
        "h": {
            "c": 0,
            "e": "",
            "t": 0.056167125701904,
            "s": 1513859444
        },
    

    相关文章

      网友评论

          本文标题:得到部分接口分析

          本文链接:https://www.haomeiwen.com/subject/jjnfgxtx.html