Add a new JSON API route

def add_route(route, endpoint=None, **kw):
    """Add a new JSON API route
    """
    def wrapper(f):
        try:
            router.DefaultRouter.add_url_rule(route,
                                              endpoint=endpoint,
                                              view_func=f,
                                              options=kw)
        except AssertionError, e:
            logger.warn("Failed to register route {}: {}".format(route, e))
        return f
    return wrapper