4

We have a web service where we'd like to deliver responses that vary depending on what time it is (local time) for the client. Conceptually, let's see we have REST endpoint to report what meal is coming up next (good for Hobbits):

GET http://.../nextMeal

Response: "Next meal is lunch!"

I want to be able to make the GET request without encoding the time is a query parameter, I would think this should be possible using a HTTP header. Googling around I see there are some old drafts proposing this but nothing official nor widely adopted.

Is there such a standard? If not, why not...?

Ron Kuper
  • 817
  • 5
  • 14
  • You will find answers to your questions here: [Getting the client's timezone in JavaScript](http://stackoverflow.com/questions/1091372/getting-the-clients-timezone-in-javascript) – mrserge May 19 '15 at 00:25
  • 2
    This link assumes JavaScript running in the client's browser. What I'm asking is a solution for code running server-side, where all we have a REST endpoint and aren't running code on a client. – Ron Kuper May 19 '15 at 00:30
  • I pointed to you this topic just because it's just illogical to not run anything on clients side and hope to get information about the client. Only other way I can figure out (but you still need to do client's side) is to make cookie and read the time, when cookie was made through the XmlHttpRequest object to the current page and access the cookie header using getResponseHeader(). – mrserge May 19 '15 at 01:04

0 Answers0