I’m writing a RESTful webservice for Google AppEngine. The webservice provides a Java serialized object representation of a product based on a barcode and format. I was wondering what design methodology (if any) is preferred by RESTful design among the following options:
Option – 1:
/product?barcode=1234&format=ean_13
Option – 2:
/product/1234?format=ean_13
Option – 3:
/product/ean_13/1234
I found quite a few references on REST on SO but nothing that addresses the use of query parameters to identify a representation.
My own understanding is that it shouldn’t make a difference since the server is stateless in all three situations but I’m not sure.
It doesn’t make a difference to REST those are just three different identifiers.
From a practical HTTP perspective, there are many deployed intermediary caches that will not cache representations that have query parameters. So if want to cache these representations in public caches then maybe option 3 is better.