11
V2EX  ›  问与答

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

  •  
  •   11 · Jan 18, 2017 · 1986 views
    This topic created in 3402 days ago, the information mentioned may be changed or developed.
    想学习整理下 REST API 设计实践,谢谢。
    7 replies    2017-01-21 08:41:36 +08:00
    lhbc
        1
    lhbc  
       Jan 18, 2017
    phpdever
        2
    phpdever  
       Jan 18, 2017
    嗯, github 算是比较好的了。
    11
        3
    11  
    OP
       Jan 18, 2017
    @lhbc
    @phpdever 想探讨个情况:
    比如我需要对于一个 topic POST 一些 comment ,下面两种哪种比较好?

    (1)
    POST /topics/1/comments/

    {
    "text": "hello"
    }

    (2)
    POST /comments/

    {
    "topic_id": 1,
    "text": "hello"
    }
    a3mao
        4
    a3mao  
       Jan 18, 2017
    @11 (1) 既然是 restful 那就是这个好
    zoues
        5
    zoues  
       Jan 18, 2017 via iPhone   ❤️ 1
    swager api 貌似
    jininij
        6
    jininij  
       Jan 18, 2017 via Android
    alipay
    WeChat
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1301 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 23:51 · PVG 07:51 · LAX 16:51 · JFK 19:51
    ♥ Do have faith in what you're doing.