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

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

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -