当前位置:   article > 正文

前端接口文档范例_前端接口文档怎么写

前端接口文档怎么写

主要功能接口汇总

0. 全局说明:

0.1 接口 1-7 后端需做鉴权处理,若用户未登录则返回:

{
  error: 'Authentication Error'
}
  • 1
  • 2
  • 3

0.2 接口 8-12,16 为公司基本信息接口,13-15 为公司详情页面-产品接口

1. 获取个人页 feed 流

1.1 method: GET

1.2 path: /api/feed-messages/:feedType/:tagId/:page

1.3 options:

1.3.1 feedType-> feed 流的类型(导航栏的分类名的拼音),枚举范围:[‘quanbuzixun’, ‘hangyebaogao’, ‘meiritourongzi’, ‘tianshixiangmubaodao’, ‘xinchuangxiangmu’, ‘gaoguanbiandong’, ‘chuangyezhezhuizong’, ‘touhouzhuizong’, ‘touzijigoudongxiang’, ‘touzirendongxiang’, ‘hangyedongxiang’]

1.3.2 tagId-> 分类下的标签 id,默认值:0(表示不进行过滤),用户点击具体标签时切换取值

1.3.3 page-> 当前 feed流 的分页页码,默认值:1或不填,用户点击 加载更多按钮时切换取值

1.4 response:

type: json
example:

[
  {
    template: 'news',
    content: {
      type: '天使项目报道',
      cover: 'http://img3.cyzone.cn/uploadfile/2017/0417/20170417104548317.jpg',
      target: 'http://www.cyzone.cn/a/20170417/309946.html',
      title: 'OFO高颜值新车,骑上秒变台湾偶像剧画风,配套“丢一台赔一台”',
      summary: '自创立以来,牛电科技引入了众多汽车级的配置。从U1系列开始,小牛全面使用自主设计的机,搭配汽车级无钥匙启动功能,用户使用遥控器便可远程解锁……',
      tags: ['共享', '腾讯系', '资源重整'],
      date: '5月20日 17:22',
      source: '36Kr',
      concerned: false
    }
  },
  {
    template: 'startup',
    content: {
      type: '新创产品',
      cover: 'http://img2.ctoutiao.com/uploads/2017/03/02/06ef4c5b36ea6cf933864416aa8abee2.jpg@!160x100',
      target: 'http://www.ishumei.com/',
      title: '数美科技',
      related_issues: ['张一鸣'],
      summary: '阅后即焚,为了让你的每一条消息都显得珍贵。独特的短视频交流,同样的时间,你可以表达更多信息。在 Ubi,你可以和更多的外国友人进行互动。',
      category: '文化娱乐 > 媒体及阅读',
      date: '12月13日',
      praised: false,
      praised_by: [
        {
          id: 15623,
          name: '张一博',
          avatar: null
        },
        {
          id: 26345,
          name: '李至婷',
          avatar: 'http://p1.qqyou.com/touxiang/UploadPic/2015-6/19/2015061914565050137.jpeg'
        },
        {
          id: 33254,
          name: '王彦武',
          avatar: 'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQbHJFnSXFf2QhmqGDviRygpHUSmZIvRZpU2Kvp3WK1W9MheWLD'
        }
      ]
    }
  },
  {
    template: 'report',
    content: {
      type: '行业报告',
      cover: 'http://img.mp.itc.cn/upload/20170310/2c9d1d62ed3b4ded837432c53f9e8300_th.jpg',
      target: 'http://mt.sohu.com/20170310/n482906790.shtml',
      title: '极光大数据:app风云榜2月app榜单',
      summary: '新年伊始,2月的app风云榜依然是风起云涌。共享单车领域方兴未艾,短视频平台作为下一个风口已经蓄势待发。摩拜与ofo谁能领跑共享单车?快手、美拍、小咖秀谁是短视频平台的未来?国内领先的移动大数据服务商极光大数据推出《app风云榜——2月app榜单》,从市场渗透率、日活跃用户、新增用户数、7天留存率等关键指标为您解读国内app的现状。',
      tags: ['app', '大数据'],
      date: '4月8日 14:20',
      concerned: true
    }
  },
  {
    template: 'moment',
    content: {
      type: '创业者追踪',
      user: {
        id: 45869,
        name: '范赵尹',
        avatar: 'https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRfaU8Wz8rdPWqd881rKCg6te3KEP8Ym3sPlU8Fo8EH-WjpFsAIvA',
      },
      content: {
        html_cotent: '<div class="WB_text W_f14" node-type="feed_list_content" action-type="feed_list_ad" style="display: none;">《这是莫迪的时代,这是一个好时代吗? | 毛克疾》 国大党通过配额优惠、财政补贴等扶持包括贱民在内的“列表种姓”、包括部落民在内的“列表部落”和包括大量中低种姓的“其他落后种姓”。这导致印度中产阶级和中上层种姓在考学、招工中遭遇了严重的逆向歧视,他们大规模转投主张取消优惠、平等竞争的 ​​​​...</div>',
        date: '4月23日 22:03',
        source: '微博',
        status: {
          read: 5200,
          loved: 136,
          shared: 36
        }
      },
      concerned: true
    }
  },
  {
    template: 'activity',
    content: {
      type: '投资人动向',
      cover: 'http://www.huodongshu.com/template/0011406030900/images/head_pic.png',
      target: 'http://www.huodongshu.com/event/10042760/?is_easy=2',
      title: '【创业导引课】唐大牛丨创业是追逐机会还是创造价值,了解创业者是技术也是艺术',
      related_issues: ['唐大牛', '华创资本'],
      date: {
        start: '2017.03.15 19:10',
        end: '2017.03.15 20:55'
      },
      address: '北京市海淀区清华大学第六教学楼A区316',
      host: '水木清华校友基金',
      source: '活动树',
      concerned: false
    }
  },
  {
    template: 'recruitment',
    content: {
      type: '投后追踪',
      cover: '',
      target: 'https://www.lagou.com/',
      title: '产品经理',
      company: '西安数美软件科技有限公司',
      category: '文化娱乐 > 媒体及阅读',
      salary: '10-24K',
      area: '西安',
      degree: '本科',
      seniority: '3-5年经验',
      date: '4月8日 17:22',
      concerned: true
    }
  }
]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117

1.5 其他说明

1.5.1 feedType 与 template 对照关系

行业报告 - report
每日投融资 - news
天使醒目报道 - news
新创项目 - startup
高管变动 - news/moment
创业者追踪 - news/moment/activity
投后追踪 - news/activity/recruitment
投资机构动向 - news
投资人动向 - news/moment/activity
行业动向 - news/report
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

2. 获取个人页左边栏导航菜单

2.1 method: GET

2.2 path: /api/personal-menu/

2.3 options: 无

2.4 response:

type: json
example:

{
  "touqian": [
    {
      "type": "hangyebaogao",
      "text": "行业报告",
      "child": [
        {
          "id": "15265",
          "text": "真格基金"
        }
      ]
    },
    {
      "type": "meiritourongzi",
      "text": "每日投融资",
      "child": [
        {
          "id": "15265",
          "text": "真格基金"
        }
      ]
    },
    {
      "type": "tianshixiangmubaodao",
      "text": "天使项目报道",
      "child": [
        {
          "id": "15265",
          "text": "真格基金"
        }
      ]
    },
    {
      "type": "xinchuangxiangmu",
      "text": "新创项目",
      "child": [
        {
          "id": "15265",
          "text": "真格基金"
        }
      ]
    },
    {
      "type": "gaoguanbiandong",
      "text": "高管变动",
      "child": [
        {
          "id": "15265",
          "text": "真格基金"
        }
      ]
    }
  ],
  "touhou": [
    {
      "type": "chuangyezhezhuizong",
      "text": "创业者追踪",
      "child": [
        {
          "id": "15265",
          "text": "真格基金"
        },
        {
          "id": "456235",
          "text": "创新工场"
        }
      ]
    },
    {
      "type": "touhouzhuizong",
      "text": "投后追踪",
      "child": [
        {
          "id": "15265",
          "text": "真格基金"
        },
        {
          "id": "456235",
          "text": "创新工场"
        }
      ]
    },
    {
      "type": "touzijigoudongxiang",
      "text": "投资机构动向",
      "child": [
        {
          "id": "15265",
          "text": "真格基金"
        },
        {
          "id": "456235",
          "text": "创新工场"
        }
      ]
    },
    {
      "type": "touzirendongxiang",
      "text": "投资人动向",
      "child": [
        {
          "id": "15265",
          "text": "真格基金"
        },
        {
          "id": "16542",
          "text": "IDG"
        },
        {
          "id": "26345",
          "text": "腾讯创投"
        },
        {
          "id": "21367",
          "text": "创新工场"
        }
      ]
    },
    {
      "type": "hangyedongxiang",
      "text": "行业动向",
      "child": [
        {
          "id": "15265",
          "text": "真格基金"
        },
        {
          "id": "16542",
          "text": "IDG"
        },
        {
          "id": "26345",
          "text": "腾讯创投"
        },
        {
          "id": "21367",
          "text": "创新工场"
        },
        {
          "id": "15265",
          "text": "真格基金"
        },
        {
          "id": "16542",
          "text": "IDG"
        },
        {
          "id": "26345",
          "text": "腾讯创投"
        },
        {
          "id": "21367",
          "text": "创新工场"
        },
        {
          "id": "15265",
          "text": "真格基金"
        },
        {
          "id": "16542",
          "text": "IDG"
        },
        {
          "id": "26345",
          "text": "腾讯创投"
        },
        {
          "id": "21367",
          "text": "创新工场"
        }
      ]
    }
  ]
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174

2.5 其他说明

2.5.1 相关名词释义:
touqian - 投前(包括 行业报告、每日投融资、天使项目报道、新创项目、高管变动 5个分类)
touhou - 投后(包括 创业者追踪、投后追踪、投资机构动向、投资人动向、行业动向 5个分类)
type - 与接口 1 中 feedType 对应,若 feedType 为 quanbuzixun(全部资讯),则接口 2 中返回的数据可能包含多种 type
child - 分类下的标签,用户通过点击标签可以过滤该分类feed流的内容(实质上是改变参数重新调用接口 1 加载 feed流)

3. 获取快讯内容列表

3.1 method: GET

3.2 path: /api/humming-flash

3.3 options 无

3.4 response:

type: json
example:

[
  {
    title: '乐视全球投融资主管郑孝明离职或加盟京东',
  
  • 1
  • 2
  • 3
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/839338
推荐阅读
相关标签
  

闽ICP备14008679号