V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
11
V2EX  ›  问与答

推荐几个你觉得设计、构架比较好的 REST API?

  •  
  •   11 · 2017-01-18 13:42:45 +08:00 · 1519 次点击
    这是一个创建于 2655 天前的主题,其中的信息可能已经有所发展或是发生改变。
    想学习整理下 REST API 设计实践,谢谢。
    7 条回复    2017-01-21 08:41:36 +08:00
    lhbc
        1
    lhbc  
       2017-01-18 13:45:49 +08:00
    phpdever
        2
    phpdever  
       2017-01-18 18:30:09 +08:00
    嗯, github 算是比较好的了。
    11
        3
    11  
    OP
       2017-01-18 18:35:16 +08:00
    @lhbc
    @phpdever 想探讨个情况:
    比如我需要对于一个 topic POST 一些 comment ,下面两种哪种比较好?

    (1)
    POST /topics/1/comments/

    {
    "text": "hello"
    }

    (2)
    POST /comments/

    {
    "topic_id": 1,
    "text": "hello"
    }
    a3mao
        4
    a3mao  
       2017-01-18 18:39:04 +08:00
    @11 (1) 既然是 restful 那就是这个好
    zoues
        5
    zoues  
       2017-01-18 18:49:53 +08:00 via iPhone   ❤️ 1
    swager api 貌似
    jininij
        6
    jininij  
       2017-01-18 18:55:03 +08:00 via Android
    alipay
    WeChat
    11
        7
    11  
    OP
       2017-01-21 08:41:36 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   935 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 22:05 · PVG 06:05 · LAX 15:05 · JFK 18:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.