def register_api(view, endpoint, url, pk='id', pk_type='int'): """Register API endpoints. Registers new end points for the API using classes. """ view_func = view.as_view(endpoint) csrf.exempt(view_func) blueprint.add_url_rule(url, view_func=view_func, defaults={pk: None}, methods=['GET', 'OPTIONS']) blueprint.add_url_rule(url, view_func=view_func, methods=['POST', 'OPTIONS']) blueprint.add_url_rule('%s/<%s:%s>' % (url, pk_type, pk), view_func=view_func, methods=['GET', 'PUT', 'DELETE', 'OPTIONS'])
def register_api(view, endpoint, url, pk='id', pk_type='int'): """Register API endpoints. Registers new end points for the API using classes. """ view_func = view.as_view(endpoint) csrf.exempt(view_func) blueprint.add_url_rule(url, view_func=view_func, defaults={pk: None}, methods=['GET', 'OPTIONS']) blueprint.add_url_rule(url, view_func=view_func, methods=['POST', 'OPTIONS']) blueprint.add_url_rule('%s/<%s:%s>' % (url, pk_type, pk), view_func=view_func, methods=['GET', 'PUT', 'DELETE', 'OPTIONS'])