When to use Query Parameter and when to use matrix parameter?

Solution

The parameters in a URI can either be query parameter or matrix parameters. There are many advantages of matrix parameter over query parameter: -

1) Matrix parameters are considered to be part of URI by proxies which allow it to be cached whereas URI's with "?" i.e query parameters are not cached.

2) Matrix parameters can be used at any point in the URI which makes it possible to set parameters where they are needed instead of appending all at the end.

3) Matrix parameters can occur with different sub-resources with different values in same URI 

 For example: - http://localhost/category;name=abc/article;name=xyz

Share this thread

Comments

Comments
comments powered by Disqus

Navigation

Social Media