rest - How to handle conflicting HTTP GET param -


i'm designing rest api supports http parameters. in cases accept 1 value parameter. how should handle duplicate parameters?

for example, stack overflow accepts param tab:

http://stackoverflow.com/?tab=hot http://stackoverflow.com/?tab=featured 

duplicate parameters allowed, passing both values correct:

http://stackoverflow.com/?tab=hot&tab=featured 

what should do? go first value, silently ignoring other values (what does) or return error stating 1 value allowed? in latter case, error should return status code (409 conflict, perhaps)?

i agree vksingla design decision, therefore there no correct answer opinions in matter.

if ask me make 'strict' api , throw error (i make sure clear error , not random code doesn't user). prefer strict approach because if usercode adding same param twice bug somewhere in users code. revealing bug possible helps user finding bug asap.

if choose go ignoring other parameters make sure user knows behavior. example document 'all duplicate parameters after first ignored'. undocumented 'magic behavior' can make code pretty damn hard debug.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -