web services - API Desing: User Location -


we're designing api hand-held application used in hospital. url of api restfull /foo/bar/238. response needs localized, we'll use accept-language header. however, of meta-data returned api call, needs dependent on nursing-unit application used.

given device knows location, best way send information along request:

  • use custom header (or predefined, if such thing exists)
  • tag along in querystring
  • something else...

obviously both (headers, query parameters) technically work, think comes down personal preference somewhat.

i argue against headers normally, since part of infrastructure of http, , not, or should not part of content. also, clients can not "discover" or "browse" using headers, , goes against rest.

so, must part of uri, example query parameters. has advantage, can linked, tested, navigated, cached, etc.


Comments

Popular posts from this blog

Unlimited choices in BASH case statement -

Redirect to a HTTPS version using .htaccess -

javascript - jQuery: Add class depending on URL in the best way -