Handling full ISO 8601 timestamps in URLs

7,633 views
Skip to first unread message

Ivan Van

unread,
Oct 4, 2013, 6:25:06 PM10/4/13
to api-...@googlegroups.com
Hi,

I'm working on an API where we plan to take start/end timestamps in the ISO 8601 format (http://www.w3.org/TR/NOTE-datetime, example: 2013-10-05T00:23:54+02:00), since we need all the information, including the time zone of the timestamp. This would require the caller to encode the ":" and "+" characters in their URL though. We want to use a known standard if possible, but this would cause too much inconvenience for the caller. From a design standpoint, what's the best way to solve this issue? Thanks!

- Ivan

Jack Repenning

unread,
Oct 4, 2013, 6:37:15 PM10/4/13
to api-...@googlegroups.com
On Oct 4, 2013, at 3:25 PM, Ivan Van <ivan...@opower.com> wrote:

From a design standpoint, what's the best way to solve this issue? Thanks!

There's a URL-safe date-time format, 20130903T13:17:45Z. Can you switch?

signature.asc

Vladimir Prudnikov

unread,
Oct 25, 2013, 8:26:01 AM10/25/13
to api-...@googlegroups.com
He only problem here is + which will be replaced with space. But you can translate dates in UTC and pass them in URLs. The same date in UTC will be 2013-10-05T00:21:54Z which can be normally used in URL http://httpbin.org/get?date=2013-10-05T00:21:54Z

Henning Bredel

unread,
Oct 25, 2013, 9:15:11 AM10/25/13
to api-...@googlegroups.com
Using just UTC time strings could be a reason.

However, you should think of who is the actual caller of your URLs. The
API itself should be consumed by applications which shall (if correctly
implemented) encode all parameter values. The actual URL calls are
transparent to the end user.

What you describe is that you do want to avoid such inconveniences to a
developer who may want to type some URLs by hand. IMHO, encoding values
is daily bread when coding against URLs.

Just my quick opinion on this.

Henning

Am 25.10.2013 14:26, schrieb Vladimir Prudnikov:
> He only problem here is + which will be replaced with space. But you can
> translate dates in UTC and pass them in URLs. The same date in UTC will
> be 2013-10-05T00:21:54Z which can be normally used in URL
> http://httpbin.org/get?date=2013-10-05T00:21:54Z
>
> On Saturday, October 5, 2013 12:25:06 AM UTC+2, Ivan Van wrote:
>
> Hi,
>
> I'm working on an API where we plan to take start/end timestamps in
> the ISO 8601 format (http://www.w3.org/TR/NOTE-datetime
> <http://www.w3.org/TR/NOTE-datetime>, example:
> 2013-10-05T00:23:54+02:00), since we need all the information,
> including the time zone of the timestamp. This would require the
> caller to encode the ":" and "+" characters in their URL though. We
> want to use a known standard if possible, but this would cause too
> much inconvenience for the caller. From a design standpoint, what's
> the best way to solve this issue? Thanks!
>
> - Ivan
>
> --
> You received this message because you are subscribed to the Google
> Groups "API Craft" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to api-craft+...@googlegroups.com.
> Visit this group at http://groups.google.com/group/api-craft.
> For more options, visit https://groups.google.com/groups/opt_out.

sune jakobsson

unread,
Oct 25, 2013, 12:41:43 PM10/25/13
to api-...@googlegroups.com
Percent encoding as described in this RFC http://tools.ietf.org/html/rfc3986 does the trick, by why do you want that?

Sune


--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages