代码之家  ›  专栏  ›  技术社区  ›  Stefano Borini

REST和多种数据格式

  •  13
  • Stefano Borini  · 技术社区  · 16 年前

    问题是:实现这一目标的推荐风格是什么?三个选项(更多来自您的有益建议)

    1. http://example.com/questions/12345/?format=json
    2. http://example.com/questions/1234/json/ http://example.com/json/questions/12345/ http://example.com/questions/1234/xml/ 等等…你明白了)

    谢谢!

    :补充建议如下

    http://example.com/questions/12345.json 。这看起来不错,但这不意味着,为了保持一致性,我们也应该 http://example.com/questions/12345.html

    3 回复  |  直到 16 年前
        1
  •  28
  •   Ryan Kennedy    16 年前

        2
  •  6
  •   RichieHindle    16 年前

    选项1

    (同样的论点也适用于 PUT / POST

        3
  •  2
  •   SerialSeb    16 年前