When to use query parameters versus matrix parameters?

后端 未结 1 1632
陌清茗
陌清茗 2020-11-30 18:50

Query parameters: http://example.com/apples?order=random&color=blue

Matrix parameters: http://example.com/ap

相关标签:
1条回答
  • 2020-11-30 19:32

    The differences between Matrix parameters and Query Parameters are much more than just convention.

    The main differences are:

  • urls with query params won't have their response cached by intermediaries/proxies (at present)
  • matrix parameters may appear anywhere in path
  • calculating the relative uri is different
  • query params are generally abused to add new verbs instead of using existing methods on resources
  • matrix parameters are not resources, they are aspects that help reference a resource in an information space that is difficult to represent within a hierarchy
  • I've written it up in more detail and with more references in Query vs. Matrix Parameters

0 讨论(0)
提交回复
热议问题