Querystring in REST Resource url -



Querystring in REST Resource url -

i had give-and-take colleague today around using querystring in rest urls. take these 2 examples

1. http://localhost/findbyproductcode/4xxheua 2. http://localhost/findbyproductcode?productcode=4xxheua

my stance urls should designed in illustration 1. cleaner , think right within rest. in eyes right homecoming 404 error illustration 1 if product code did not exist illustration 2 returning 404 wrong page should exist. stance didnt matter , both same thing.

as neither of able find concrete evidence (admitably search not extensive) know other people's opinions on this.

kind regards colin g

in typical rest api's, illustration #1 more correct. resources represented uri , #1 more. returning 404 when product code not found absolutely right behavior. having said that, modify #1 little more expressive this:

http://localhost/products/code/4xheaua

look @ other well-designed rest apis - example, @ stackoverflow. have:

stackoverflow.com/questions stackoverflow.com/questions/tagged/rest stackoverflow.com/questions/3821663

these different ways of getting @ "questions".

rest

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -