humanmade / hm-time

6 stars 3 forks source link

Update endpoint ideas #1

Open rmccue opened 10 years ago

rmccue commented 10 years ago

From the readme:

The JSON API is also an important component so we can use this data elsewhere, and I imagine would have endpoints somethign like:

GET /api/time/now

Returns a list of users with their timezones and working hours

The reason I put "now" is if in the future we were to integrate vacatios etc, this endpoint would just reflect the people who are curently working, where as /api/time may return all the users and data with working schedules etc.

The Extending the API guide is a good reference here.

Here's what I'd envision it looking more like:

[
    {
        "author": {
            "ID": 1,
            ...
        },
        "timezone": "Australia/Brisbane",
        "current_time": "2013-06-02T05:28:00+10:00"
    },
    ...
]

Where:

That's my cursory thinking, just looking at this quickly. :)

joehoyle commented 10 years ago

@rmccue thanks for the feedback - @missjwo will hopefully be tackling this, so the above will be of use to her I imagine.

rmccue commented 10 years ago

Also, if you do it with this format, creating the same widget as currently exists is pretty simple. :)

Using Mustache syntax, individual items are something like:

<li class="zone">
    <span class="clock">{{ current_time }}</span>
    <span class="humans"><img width="24" title="{{ author.name }} - {{ timezone }}" alt="{{ author.name }}" src="{{ author.avatar }}"></span>
</li>